See https://github.com/doctrine/doctrine2/issues/4568
Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On Tue, Jun 20, 2017 at 9:44 AM, Marc Verney <[email protected]> wrote: > Hello, > > Let's say I've got two Doctrine entities, Person and Company. Both have > an address field which accepts an Address value object. As per business > rules, Company::Address is required while Person::Address can be null. > > > Doctrine 2.5 proposes the Embeddable type > <http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/embeddables.html>, > which was apparently built with value objects in mind and, indeed, I see it > as a perfect solution for my case. > > > However, there's one thing I can't do: declare that Person::Address is > nullable while Company::Address is not. A boolean nullable attribute > exists for the Embeddable's fields themselves, but of course this applies > to every entity the Address is embedded in. > > > Does anybody know if I'm missing something, or if this is due to a > technical limitation, if there's a workaround, etc. ? Right now the only > solution I see is to declare all Embeddable fields as nullable: true and > handle the nullable constraints in my code. > > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
