/** * 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; }
/** * 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; }