Comments (5)
It seems this was not built to support objects but scalars. Perhaps that can clarify the question.
I am also interested if this was done for elasticsearch, why the interface was forced to that and not support objects underneath the serialization output?
from broadway.
I think also in https://github.com/qandidate-labs/broadway/blob/master/src/Broadway/Domain/Metadata.php#L50 when it gets serialized and the information accessible as an array then is a bit misleading. Maybe there should be a note somewhere in the docs about acknowledging that the concept of serialization is not to strings but to arrays because of elastic search and for practical reasons which would be good to list. This I say having in view that lots of users come from the background where serialization ends up in a string.
from broadway.
one more reason to tag the package to include the metadata accessing fix on projector land from @mbadolato ! 👴
from broadway.
@Richtermeister thanks for the compliment 😄
I wasn't involved from the start, so I don't know about all the design decisions. But I'm guessing serializing to flat array is just convenient. In the end it gets saved as json in the database, which is a lot easier with arrays :-)
How we handle value object, is by calling the serialize method on those objects:
class Foo {
private $stringProperty;
private $valueObject;
public function serialize() {
return array(
'stringProperty' => $this->stringProperty,
'valueObject' => $this->valueObject->serialize()
);
}
}
And with deserializing we reconstuct the value objects. Which usually is just instantiating it, as all properties are part of the constructor in our case.
from broadway.
@Richtermeister I'm closing this for now, if you have any further questions, please re-open or ask in our IRC channel (#qandidate on Freenode)
from broadway.
Related Issues (20)
- drop test/Broadway/TestCase
- make PHPUnit a dependency HOT 5
- test the test helpers with examples HOT 2
- Built-in asynchronous way to run processors? HOT 3
- Example/explanation on event sourcing for aggregate roots HOT 1
- What is the overall state of the project? Is it GDPR ready? HOT 2
- Simple Command Bus - Manage Throwable exceptions
- Could you do a new release? HOT 2
- Are there any plans to update broadway? HOT 1
- Asymmetry between EventBus interface and EventListener interface HOT 2
- Broadway does not seem to survive hot upgrades HOT 2
- duck-typing vs interface HOT 1
- Replaying events to rebuild elastic search index HOT 1
- PHP 8 support HOT 2
- Processor after projector HOT 2
- Aggregator HOT 3
- Indirect development dependency used in src ConcurrencyConflictResolvers
- no recent tags? HOT 1
- Get uncommitted events without empty the aggregate HOT 4
- Give serializers flexibility to map based on event type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from broadway.