/** * Returns class name to use for decoration * * If the component does not have a class named "ComponentController" * the default SystemComponentController class is used * @param \Cx\Core\Core\Model\Entity\SystemComponent $component Component to get decoration class for * @return string Full qualified class name */ protected function getComponentControllerClassFor(\Cx\Core\Core\Model\Entity\SystemComponent $component) { if (!$this->cx->getClassLoader()->getFilePath($component->getDirectory(false) . '/Controller/ComponentController.class.php')) { return '\\Cx\\Core\\Core\\Model\\Entity\\SystemComponentController'; } $className = $component->getNamespace() . '\\Controller\\ComponentController'; return $className; }
/** * Loads the systemComponent using the doctrine entity manager for the existing SystemComponentController and adds it to the repository * @param array $preLoadedComponents An array containing the preloaded components */ public function setPreLoadedComponents($preLoadedComponents) { foreach ($preLoadedComponents as $componentName => $preLoadedComponent) { // get systemComponent by name $systemComponent = parent::findOneBy(array('name' => $componentName)); // set systemComponent on existing systemComponentController $preLoadedComponent->setSystemComponent($systemComponent); // add yaml directory $yamlDir = $this->cx->getClassLoader()->getFilePath($preLoadedComponent->getDirectory(false) . '/Model/Yaml'); if (file_exists($yamlDir)) { $this->cx->getDb()->addSchemaFileDirectories(array($yamlDir)); } // store the systemComponent with its now loaded id as key to the array of loaded components $this->loadedComponents[$preLoadedComponent->getId()] = $preLoadedComponent; // Add JSON adapter \Cx\Core\Json\JsonData::addAdapter($preLoadedComponent->getControllersAccessableByJson(), $preLoadedComponent->getNamespace() . '\\Controller'); } }