#1626: Option to prevent autoinstantiation of foreign records during get()
operations
-----------------------------------+----------------------------------------
Reporter: adamthehutt | Owner: romanb
Type: defect | Status: new
Priority: major | Milestone: 1.2.0
Component: Relations | Version: 1.0.3
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 1
-----------------------------------+----------------------------------------
Changes (by jwage):
* 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>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---