public function createSchema() { $metas = []; foreach (Deployment::instance()->models as $model) { $metas[] = $this->entityManager->getClassMetadata($model); } $this->schemaTool->createSchema($metas); }
public static function init() { // vendors self::$paths = ['Doctrine' => ZOOL_PATH . '/doctrine/Doctrine', 'Annotation' => ZOOL_PATH . '/annotation/Annotation']; $modules = Deployment::instance()->modules; foreach ($modules as $moduleName => $moduleDefinition) { self::import($moduleDefinition['path'], $moduleName); } spl_autoload_register('zool\\Zool::loadClass'); }
public function exists($module) { return isset(Deployment::instance()->modules[$module]); }
/** * Private constructor. */ private function __construct() { $this->events = Deployment::instance()['events']; }
/** * @return string path of deployment descriptor */ public static function getDeploymentDescriptorPath() { return Deployment::getDeploymentDescriptorPath(); }
/** * Default. */ private function __construct($module) { $this->infos = array_merge_recursive(self::$moduleInfoStub, Deployment::instance()->modules[$module]['info']); }
/** * Loads locale file if exists. */ private function loadLocale($lang, $fileBase, $messageKey) { if (!isset($this->messages[$lang])) { $this->messages[$lang] = []; } // load from file if (!isset($this->messsages[$lang][$fileBase])) { $localSuffix = '/' . self::LOCALE_DIRNAME . '/' . $lang . '/' . $fileBase . self::LOCALE_FILE_EXTENSION; $localeFile = new File(APP_PATH . $localSuffix); if ($localeFile->exists()) { // when the module not $this->messsages[$lang][$fileBase] = (require_once $localeFile->getPath()); } if (!isset($this->messsages[$lang][$fileBase][$messageKey])) { foreach (Deployment::instance()->modules as $moduleName => $moduleDef) { if ($moduleName == $fileBase) { $moduleFileBase = Strings::splitBy($messageKey, self::MESSAGE_PATH_SEPARATOR)[0]; $this->tryToLoadLocaleFormModule($lang, $moduleName, $moduleDef['path'], $moduleFileBase); } } } // could not loaded from anywhere if (!isset($this->messsages[$lang][$fileBase])) { $this->messsages[$lang][$fileBase] = []; } } $this->loadedFileBases[] = $fileBase; }
/** * * @param string $componentName name of component * @throws ComponentException if component name not found * @return int scope type */ public static function getComponentScope($component) { $component = self::getFullyQualifiedName($component); if (isset(Deployment::instance()->components[$component])) { $componentDefinition = Deployment::instance()->components[$component]; $componentAnnotations = $componentDefinition['annotations']; $scopeAnnotation = AnnotationManager::instance()->getAnnotation($componentAnnotations, 'Scope', $component); if (null !== $scopeAnnotation) { return $scopeAnnotation->value; } return ScopeType::UNSPECIFIED; } throw new ComponentException("Undefined component: {$component}"); }