Say I have two Doctrine objects, Personand Company. Both have a field addressthat accepts an address value object. In accordance with business rules is required Company::Address, and Person::Addressmay be zero.
Doctrine 2.5 offers an embeddable type that seems to have been built with value objects and, in fact, I find this the ideal solution for my case.
However, I can’t do anything: declare what Person::Addressis valid, but Company::Addressnot. The boolean attribute nullableexists for the nested fields themselves, but, of course, this applies to all entities in which the address is nested.
Does anyone know if I missed something, or if it is due to a technical limitation, if there is a workaround, etc.? Right now the only solution I see is to declare all nested fields as nullable: trueand handle the restriction in my code.
marcv source
share