Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 2.0-BETA3
-
Fix Version/s: None
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
When creating a reference (i.e. {{ $ref = $em->getReference('\Foo', 1); }}), getting the value of the primary key (i.e. {{ $ref->getId(); }}) fetches the object from the database.
My understanding ot Doctrine is that the references are proxies to real objects, and that calling any method on them will trigger a fetch from the database, which makes sense.
May be this could be improved so that proxies have a check like {{ if (I_am_a_reference() and this_is_a_pkey_getter()) return $pkey) }}. This_is_a_pkey_getter() could get its knowledge from some @PrimaryKeyGetter entity annotation.
The references could then be used in place of the PartialReferences, without the huge WTF-factor of partial references and partial objects.
Issue Links
- relates to
-
DDC-522
Join columns can not be named the same as the association fields.
-
Something like this would be awesome :
class MyEntity { /** * @Id @Getter('getId') */ $id; /** declared getter on an @Id property, this method is not proxied / do not triggers database fetches */ function getId() { } }Or this:
class MyEntity { /** * @NoProxy */ function getId() { } }