コード例 #1
0
 /**
  * Generate model class code
  * 
  * @param Module $module
  * @param string $modelName
  * @param array $arrayValues
  * @return string
  */
 protected function generateCode(Module $module, $modelName, $arrayValues)
 {
     $replaces = array('<namespace>' => 'namespace ' . $module->getNamespace() . '\\Model;', '<modelAnnotation>' => $this->generateDocBlock($modelName), '<modelClassName>' => $modelName, '<construct>' => self::$constructorMethodTemplate, '<modelBody>' => $this->generateBody($modelName, $arrayValues), '<spaces>' => "    ", '<table>' => strtolower($modelName));
     $classTemplate = str_replace(array_keys($replaces), array_values($replaces), self::$classTemplate);
     return $classTemplate;
 }
コード例 #2
0
 /**
  * Add Module
  * 
  * @param Module $module
  * @return Container
  * @throws \LogicException
  */
 public function addModule(Module $module)
 {
     $name = $module->getName();
     if (isset($this->modules[$name])) {
         throw new \LogicException(sprintf('Trying to register two modules with the same name "%s"', $name));
     }
     $this->view->addTemplatePath($module->getPath() . '/Resources/views');
     $this->modules[$name] = $module;
     return $this;
 }