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
This seems to be due to the upgrade of doctrine-bundle => v2.0.0.
You have to change :
In your "App\Repository\AbsenceRepository" please update your constructor:
public function __construct(\Doctrine\Common\Persistence\ManagerRegistry $registry)
{
parent::__construct($registry, Address::class);
}