in my project symfony 4 I wanted to make a Composer update, something he did.
But since, it puts me an error on all my controllers when I use the ObjectManager in my constructors, like this :
use Doctrine\Common\Persistence\ObjectManager;
/**
* Manager
*
* @var ObjectManager
*/
private $manager;
public function __construct(ObjectManager $manager)
{
$this->manager = $manager;
}
I've this kind of error :
Cannot autowire service "App\Controller\OrdreMissionController": argument "$manager" of method "__construct()" references interface "Doctrine\Common\Persistence\ObjectManager" but no such service exists. You should maybe alias this interface to the existing "doctrine.orm.default_entity_manager" service.
It applies to all my controllers since they all have the ObjectManager, I do not understand what is happening
Doctrine\ORM\EntityManagerInterface
instead ofObjectManager
. – yiviCannot autowire service "App\Repository\AbsenceRepository": argument "$registry" of method "__construct()" references interfac e "Symfony\Bridge\Doctrine\RegistryInterface" but no such service exists. Try changing the type-hint to "Doctrine\Common\Persi stence\ManagerRegistry" instead.
While it's Doctrine that puts this class by default when it creates the repositories – eronn