DDC-28: ProxyClassGenerator should not attempt to override static methods #37

Closed
opened 2026-01-22 12:24:59 +01:00 by admin · 1 comment
Owner

Originally created by @doctrinebot on GitHub (Oct 1, 2009).

Jira issue originally created by user itoijala:

ProxyClassGenerator overrides all of the methods of the entity class. This includes static methods. If the entity class has a static method, an error occurs:

Fatal error: Cannot make static method Model\User\User::getCurrentUser() non static in class Doctrine\Generated\Proxies\Model_User_UserAProxy in C:\Windows\Temp\Model_User_UserAProxy.g.php on line 200

ProxyClassGenerator should ignore static methods. They do not need to be overriden, since they do not require the entity to be loaded.

A simple fix is to change the line 143 from:

if ($method->isPublic() && ! $method->isFinal()) {

to:

if ($method->isPublic() && ! $method->isFinal() && !$method->isStatic()) {

Originally created by @doctrinebot on GitHub (Oct 1, 2009). Jira issue originally created by user itoijala: ProxyClassGenerator overrides all of the methods of the entity class. This includes static methods. If the entity class has a static method, an error occurs: Fatal error: Cannot make static method Model\User\User::getCurrentUser() non static in class Doctrine\Generated\Proxies\Model_User_UserAProxy in C:\Windows\Temp\Model_User_UserAProxy.g.php on line 200 ProxyClassGenerator should ignore static methods. They do not need to be overriden, since they do not require the entity to be loaded. A simple fix is to change the line 143 from: if ($method->isPublic() && ! $method->isFinal()) { to: if ($method->isPublic() && ! $method->isFinal() && !$method->isStatic()) {
admin added the Bug label 2026-01-22 12:25:01 +01:00
admin closed this issue 2026-01-22 12:25:02 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 3, 2009):

Issue was closed with resolution "Fixed"

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

No dependencies set.

Reference: doctrine/archived-orm#37