* milestone: 1.1.0 => 1.2.0
Old description:
> By default, accessing $record->Related automatically instantiates a new
> related Record object if one doesn't already exist. This is not always
> the desired behavior, especially in cases where the related record is
> "optional" (i.e. 1 to 0/1).
>
> There should be an 'autoInstantiate' option when defining a hasOne()
> relationship. For backwards compatability, the default behavior should
> not change. But if one sets 'autoInstantiate' => false, then a non-
> existing related object must be explicitly created.
>
> I'm working on a test and patch for this, which I'll attach when I have
> them.
New description:
By default, accessing $record->Related automatically instantiates a new
related Record object if one doesn't already exist. This is not always the
desired behavior, especially in cases where the related record is
"optional" (i.e. 1 to 0/1).
There should be an 'autoInstantiate' option when defining a hasOne()
relationship. For backwards compatability, the default behavior should not
change. But if one sets 'autoInstantiate' => false, then a non-existing
related object must be explicitly created.
I'm working on a test and patch for this, which I'll attach when I have
them.
--
Comment:
Can you provide a patch that shows the individual changes?
--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1626#comment:5>