I need to modify some fields in my form (label and class), based on whether the entity is the latest published version or not. So I need to be able to inject the entity mana
declare your form type as service:
...
Gutensite\CmsBundle\Form\Type\ViewVersionType
...
in your form type:
...
private $em;
public function __construct(EntityManagerInterface $entityManager) {
$this->em = $entityManager;
}
or ou can inject whole container and use it like this:
$this->container->get('doctrine')->getManager('cms'); // or billing