예제 #1
0
 /**
  * Generates the code for the controller class
  * Either from ectionController template or from class partial
  *
  * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject $domainObject
  * @param boolean $mergeWithExistingClass
  * @return string
  */
 public function generateActionControllerCode(\EBT\ExtensionBuilder\Domain\Model\DomainObject $domainObject, $mergeWithExistingClass)
 {
     $controllerTemplateFilePath = $this->codeTemplateRootPath . 'Classes/Controller/Controller.phpt';
     $controllerClassFileObject = $this->classBuilder->generateControllerClassFileObject($domainObject, $controllerTemplateFilePath, $mergeWithExistingClass);
     // returns a class object if an existing class was found
     if ($controllerClassFileObject) {
         $this->addLicenseHeader($controllerClassFileObject->getFirstClass());
         return $this->printerService->renderFileObject($controllerClassFileObject, TRUE);
     } else {
         throw new \Exception('Class file for controller could not be generated');
     }
 }