/**
  * @return Form
  */
 public function createForm()
 {
     $entityClass = $this->options->getEntityClass();
     $builder = new AnnotationBuilder($this->getEntityManager());
     /**
      * @var $form Form
      */
     $form = $builder->createForm(new $entityClass());
     $form->setHydrator(new DoctrineObject($this->getEntityManager()));
     foreach ($form->getElements() as $element) {
         if ($element instanceof \DoctrineModule\Form\Element\ObjectSelect || $element instanceof \DoctrineModule\Form\Element\ObjectRadio || $element instanceof \DoctrineModule\Form\Element\ObjectMultiCheckbox) {
             $element->setOption('object_manager', $this->getEntityManager());
         } elseif ($element instanceof \MfccAdminModule\Form\Element\CyclicSheet) {
             $form->addTab($element->getName(), ['label' => $element->getLabel(), 'action' => 'cyclicSheetAction', 'entity' => $element->getOption('target_class'), 'active' => false]);
             $form->remove($element->getName());
         }
     }
     return $form;
 }
 /**
  * @param $moduleId
  * @return AdminModuleManager
  */
 protected function getAdminModuleManager($moduleId)
 {
     if (!$this->adminModuleManager instanceof AdminModuleManager) {
         $adminModuleManager = $this->getAdminModuleManagerService();
         $config = $this->getConfig();
         if (isset($config['mfcc_admin']['modules']) and isset($config['mfcc_admin']['modules'][$moduleId])) {
             $adminModuleOption = new AdminModuleOptions($config['mfcc_admin']['modules'][$moduleId]);
             $adminModuleOption->setModuleId($moduleId);
             $adminModuleManager->setOptions($adminModuleOption);
             $adminModuleMapper = new AdminModuleMapper($this->getEntityManager(), $adminModuleOption);
             $adminModuleManager->setMapper($adminModuleMapper);
         }
         $this->adminModuleManager = $adminModuleManager;
         return $this->adminModuleManager;
     } else {
         return $this->adminModuleManager;
     }
 }
 /**
  * @param $id
  * @return object
  */
 public function findById($id)
 {
     $er = $this->em->getRepository($this->options->getEntityClass());
     return $er->findOneBy(['id' => $id, 'deleted' => 0]);
 }