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 #430

Open
3 tasks
hrach opened this issue Jun 21, 2020 · 1 comment
Open
3 tasks

Embeddable & relationships #430

hrach opened this issue Jun 21, 2020 · 1 comment

Comments

@hrach
Copy link
Member

hrach commented Jun 21, 2020

Currently Embeddables does not support relationships.

Issues:

  • relationship is not connected to entity when value is set by constructor; solution: manually attach in constructor? some laziness in relationships in embeddable?
  • onesided does not bring much issues, but how to reference nested relationship on other side?
  • relationship mappers does not have access to raw values -> new api?
@hrach hrach added this to the v4.1 milestone Sep 18, 2020
@hrach hrach removed this from the v5.0 milestone Dec 11, 2021
@hrach
Copy link
Member Author

hrach commented Sep 5, 2022

Usecase:

/**
 * @property-read float    $purchase         {default 0}
 * @property-read Currency $purchaseCurrency {m:1 Currency, oneSided=true}
 * @property-read float    $selling          {default 0}
 * @property-read float    $retail           {default 0}
 */
class Price extends Embeddable
{
    public function __construct(float $purchase, Currency $purchaseCurrency, float $selling, float $retail)
    {
        parent::__construct(
            [
                'purchase' => $purchase,
                'purchaseCurrency' => $purchaseCurrency,
                'selling' => $selling,
                'retail' => $retail,
            ]
        );
    }

}

@hrach hrach removed the feature label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant