Open renanbr opened 8 years ago
I did originally think about something like that, but it seemed to be overly complicated to check if this or that functionality was enabled when serializing. And when adding new traits into the mix, the base trait would always have to be specifically told about it.
If you can come up with a way that seamlessly can support it, then I think that would be pretty cool!
I've made an initial work at the split branch to try the concept out.
Important notes:
I think those tests already fail in the current branch, don't they? @jmikola told me they were going to remove support for atomic updates
Correct. There are no plans to change the persistence spec or driver here. The ODS field will always injected into the bsonSerialize()
return value if the class implements MongoDB\BSON\Persistable
.
@derickr was actually just talking about removing the two ODS tests that we marked as XFAIL
.
I've made some experiments with @alfsb, then this idea come from these experiences. Features could be splitted on traits, so users could pick which attach to their classes.
A full-featured persistable class sample: