/** * Create a new factory with basic settings from the environment. * * This factory can be used to create a new Container, Environment, DcGeneral with the same base settings as the * given environment. * * @param EnvironmentInterface $environment The environment to use as base. * * @return DcGeneralFactory */ public static function deriveEmptyFromEnvironment(EnvironmentInterface $environment) { $factory = new DcGeneralFactory(); $factory->setEventDispatcher($environment->getEventDispatcher()); $factory->setEventDispatcher($environment->getEventDispatcher()); $factory->setTranslator($environment->getTranslator()); $factory->setEnvironmentClassName(get_class($environment)); $factory->setContainerClassName(get_class($environment->getDataDefinition())); return $factory; }
/** * @param array $options * * @return array */ public function getImportableRecipientFieldOptions($options = array()) { global $container; // todo issue to dc-general \System::loadLanguageFile('orm_avisota_recipient'); /** @var EventDispatcher $eventDispatcher */ $eventDispatcher = $container['event-dispatcher']; $dcGeneralFactory = new DcGeneralFactory(); $dcGeneralFactory->setContainerName('orm_avisota_recipient'); $dcGeneralFactory->setEventDispatcher($eventDispatcher); $containerFactory = $dcGeneralFactory->createContainer(); foreach ($containerFactory->getPropertiesDefinition()->getProperties() as $property) { $extra = $property->getExtra(); if (isset($extra['importable']) && $extra['importable']) { $options[$property->getName()] = $property->getLabel(); } } return $options; }