Doctrine2 magic repository methods
See original GitHub issueIn 0.8.0 release there was a note:
- Detect EntityRepository::find/findOneBy/findAll/findBy result type
At the moment doctrine2 support behaves like this:
$repo = $this->getDoctrine()->getRepository('Namespace:Entity');
$entity = $repo->findOneByProperty('value'); // $entity does not resolve as an Entity
$entity = $repo->findOneBy(array('property' => 'value')) // $entity does resolve as an Entity and autocomplete works
Could you please implement resolving of magic methods like findOneBy* and findBy*?
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:18 (8 by maintainers)
Top Results From Across the Web
PHPUnit Doctrine Repository magic methods - Stack Overflow
I have one method in my class that uses that magic method findOneBy... from the Doctrine EntityRepository, as showed below:.
Read more >Working with Objects - Doctrine
The Repository implement the Doctrine\Common\Collections\Selectable interface. That means you can build Doctrine\Common\Collections\Criteria and pass them to ...
Read more >How to use Repository with Doctrine as Service in Symfony
Mostly due to traditional registration of Doctrine repositories. ... You can use prepared methods like findBy() , findOneBy() right away ✓ ...
Read more >How is Doctrine 2 different to Eloquent? - Culttt
This repository object has a number of helpful methods for querying the database, such as: $users = EntityManager::getRepository("Cribbb\ ...
Read more >Inject a repository instead of an entity manager
However, I wasn't talking about entity repositories here. ... call that relies on the magic __call() method of the EntityRepository class.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same here, would love to have the “magic” Doctrine methods to be resolved in PHPStorm like
findOneBy*
return type is resolved; did a quick test on the method completion, but there is now new API available to attach it