DDC-1712: proxy calss constructor do not call it's parent constructor #2157

Closed
opened 2026-01-22 13:42:56 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 16, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user mdrolet:

I've create a OneToMany relation in my entity and into the entity constructor I define my relation property to be an ArrayCollection.
When I load an existing entity that have no entries from it's relation, I'm waiting to receive an empty ArrayCollection but I got null into the proxy entity object cause my parentEntity __consctruct is never called from the proxyEntity __construct class.

ORM/Proxy/ProxyFactory.php line 356. <-- this is where the proxy class **construct method is generated.

I'm following the Best Practice manuel :-)

http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/best-practices.html
25.8. Initialize collections in the constructor

Originally created by @doctrinebot on GitHub (Mar 16, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user mdrolet: I've create a OneToMany relation in my entity and into the entity constructor I define my relation property to be an ArrayCollection. When I load an existing entity that have no entries from it's relation, I'm waiting to receive an empty ArrayCollection but I got null into the proxy entity object cause my parentEntity __consctruct is never called from the proxyEntity __construct class. ORM/Proxy/ProxyFactory.php line 356. <-- this is where the proxy class **construct method is generated. I'm following the Best Practice manuel :-) http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/best-practices.html 25.8. Initialize collections in the constructor
admin added the Bug label 2026-01-22 13:42:56 +01:00
admin closed this issue 2026-01-22 13:42:57 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 16, 2012):

Comment created by @beberlei:

Proxies are only created for classes coming from persistence. Classes reconstructed from persistence don't call the constructor but only **wakeup and then populate all the collections from persistence.

@doctrinebot commented on GitHub (Mar 16, 2012): Comment created by @beberlei: Proxies are only created for classes coming from persistence. Classes reconstructed from persistence don't call the constructor but only **wakeup and then populate all the collections from persistence.
Author
Owner

@doctrinebot commented on GitHub (Mar 16, 2012):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Mar 16, 2012): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2157