Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeddable relationships #463

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Embeddable relationships #463

wants to merge 2 commits into from

Conversation

hrach
Copy link
Member

@hrach hrach commented Sep 26, 2020

No description provided.

@hrach hrach force-pushed the embeddable_relationship branch 2 times, most recently from 25a5436 to b29c8d4 Compare September 26, 2020 11:52
- embeddables propagate PropertyMetadata with path
- recursively set parent entity to embeddables' properties
- implements path-style fetching of raw values
@hrach
Copy link
Member Author

hrach commented Oct 19, 2020

The biggest question here is how to design immutable embeddables together with relationships, which are naturally mutable a lot and holds a state.

  • introducing support only for one-sided relationships helps a lot; (M:1 – One-sided, M:M – One-sided and 1:1 – One-sided. )

Creating embeddable would take the same data-format as relationship's set method.

// M:1; Currency is entity with code as its primary key
$book->price = new Money(100, $currency); 
$book->price = new Money(100, 'czk');

// M:M
$book->labels = new Labels('now', $user, [$label1, $label2]);

The modification will be a little bit more complicated. How to remove one label?

@hrach
Copy link
Member Author

hrach commented Oct 21, 2020

The problem with M:M relationship - to correctly know what is added and what is removed. E.g. changing the property will reload current db state multiple times. If we delay this resolution to persistence phase, it would be loaded only once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant