Open vencakrecl opened 2 years ago
Most features are now supported without needing loaders at all. I'm not sure how to solve your problem or if it needs to be solved at all.
This is my problem without loader - custom repository:
/**
* @method Notifications|null find($id, $lockMode = null, $lockVersion = null)
* @method Notifications|null findOneBy(array $criteria, array $orderBy = null)
* @method Notifications[] findAll()
* @method Notifications[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*
* @extends DocumentRepository<Notifications>
*/
class NotificationsRepository extends DocumentRepository
Property App\Services\User\UserManager::$notificationsRepository (App\Document\Repository\NotificationsRepository) does not accept Doctrine\ODM\MongoDB\Repository\DocumentRepository<App\Document\Notifications\Notifications>.
/**
* @method TrialRequest|null find($id, $lockMode = null, $lockVersion = null)
* @method TrialRequest|null findOneBy(array $criteria, array $orderBy = null)
* @method TrialRequest[] findAll()
* @method TrialRequest[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*
* @extends EntityRepository<TrialRequest>
*/
class TrialRequestRepository extends EntityRepository
Property App\Services\User\UserManager::$trialRequestRepository (App\Entity\Repository\TrialRequestRepository) does not accept Doctrine\ORM\EntityRepository<App\Entity\TrialRequest>.
@VencaKrecl i know its a long time, but did you found a workaround for this issue?
@ondrejmirtes we have the same issue with a project which also has orm AND odm. I think there are less projects who has both orm and odm, but they exist. It would be great to find a solution for this.
Maybe we can extend the configuration like this:
parameters:
doctrine:
entityObjectManagerLoader: tests/doctrine-orm-bootstrap.php
documentObjectManagerLoader: tests/doctrine-odm-bootstrap.php
@BenjaminLeibinger The workaround is to run phpstan two times with different configurations.
ignoreErrors:
- '#does not accept Doctrine\\Persistence\\ObjectManager#'
- '#does not accept Doctrine\\ODM\\MongoDB\\Repository#'
doctrine:
objectManagerLoader: orm-object-manager.php
ignoreErrors:
- '#does not accept Doctrine\\Persistence\\ObjectManager#'
- '#does not accept Doctrine\\ORM\\EntityRepository#'
doctrine:
objectManagerLoader: odm-object-manager.php
Hi, I need to define both loaders (ODM and ORM) in same Symfony project, but configuration supports only one. Can you help me?