* Initial version
This commit is contained in:
18
src/Form/Element/ElementFactory.php
Normal file
18
src/Form/Element/ElementFactory.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace DoctrineMezzioModule\Form\Element;
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
|
||||
class ElementFactory
|
||||
{
|
||||
|
||||
public function __invoke(ContainerInterface $container, string $elementClass, array $options = [])
|
||||
{
|
||||
$em = $container->get('doctrine.entity_manager.orm_default');
|
||||
/** @var ObjectSelect|ObjectRadio|ObjectMultiCheckbox $element */
|
||||
$element = new $elementClass();
|
||||
$element->setOption('object_manager', $em);
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user