I am trying to call entityManager
in formType
. I don't get why this is not working.
FormType :
private $manager;
public function __construct(ObjectManager $manager)
{
$this->manager = $manager;
}
Controller:
$form = $this->createForm(ProductsType::class, $products);
Services:
apx.form.type.product:
class: ApxDev\UsersBundle\Form\ProductType
arguments: ["@doctrine.orm.entity_manager"]
tags:
- { name: form.type }
Error:
Catchable Fatal Error: Argument 1 passed to MyBundle\Form\FormType::__construct() must implement interface Doctrine\Common\Persistence\ObjectManager, none given, called in vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php on line 90 and defined