-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't get repository at construction time, it could be not loaded yet! #574
base: master
Are you sure you want to change the base?
Conversation
After some more researches, I discovered that could be my installation fault. I'll leave this PR open, since it could be good to remove that call from constructor! |
Entity/TokenManager.php
Outdated
* @param $name | ||
* @return mixed | ||
*/ | ||
public function __get($name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not be public to provide BC with a protected property.
and it should trigger a deprecation warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__get can only be public... I can't think a method to provide retrocompatibility for private property.
Entity/TokenManager.php
Outdated
return $this->getRepository(); | ||
} | ||
|
||
return $this->$name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not allow access. This gives public access to private properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed!
👍 for me, phpstan is broken however. |
Note: this also applies to other repositories, not just EntityRepositories. |
I ran into an issue when trying to load some repositories through compiler pass.
At Doctrine\Bundle\DoctrineBundle\Repository\ContainerRepositoryFactory->getRepository(), it tried to load repository of my User Entity.
I changed the TokenManager, so it doesn't try to get it too soon!