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

Closed
doctrinebot opened this Issue Oct 1, 2009 · 1 comment

1 participant

@doctrinebot

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\ModelUser_UserAProxy in C:\Windows\Temp\Model_UserUserAProxy.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()) {

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-ALPHA2 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment