<?php

namespace UtilityModule\Form\Element;

use Interop\Container\ContainerInterface;

class ElementFactory
{

    public function __invoke(ContainerInterface $container, string $elementClass)
    {
        $em = $container->get('doctrine.entity_manager.orm_default');
        /** @var ObjectSelect|ObjectRadio|ObjectMultiCheckbox $element */
        $element = new $elementClass();
        $element->setOption('object_manager', $em);
        return $element;
    }
}
