예제 #1
0
 public static function getInstance()
 {
     if (is_null(self::$INSTANCE)) {
         self::$INSTANCE = new ModuleRepository();
     }
     return self::$INSTANCE;
 }
예제 #2
0
 /**
  * @return array
  */
 public function getField()
 {
     $findBelongsTo = $this->objectManager->getRepository('BigfishEavBundle:ModuleHasField')->findOneRelatedModule($this->field, $this->module);
     $relatedModule = $findBelongsTo->getBelongsTo();
     $query = $this->objectRepository->getRepository($relatedModule)->setClass(new EavModuleRepository())->findByNotDeleted();
     $options = $findBelongsTo->getOptions() ? $findBelongsTo->getOptions() : array();
     if (!array_key_exists('choiceItemLabel', $options)) {
         throw new \Exception('choiceItemLabel is required');
     }
     $choices = array();
     foreach ($query as $item) {
         $choices[$item['container_id']] = $this->parser->parse($options['choiceItemLabel'], array('row' => $item));
     }
     if (array_key_exists('multiple', $options)) {
         $this->typeChoice['multiple'] = (bool) $options['multiple'];
     }
     if (array_key_exists('expanded', $options)) {
         $this->typeChoice['expanded'] = (bool) $options['expanded'];
     }
     return array('identifier' => $this->field->getIdentifier(), 'formType' => new RelatedContainerType($choices, $this->typeChoice), 'formAttributes' => array('label' => $this->field->getName(), 'attr' => array('help_text' => $this->field->getDescription())));
 }
예제 #3
0
 /**
  * Returns an array of all installed modules
  */
 public static function installModList($active_only = false)
 {
     return ModuleRepository::getInstance()->getActiveModules();
 }