예제 #1
0
 /**
  * Generates the code for the repository class
  * Either from domainRepository template or from class partial
  *
  * @param \EBT\ExtensionBuilder\Domain\Model\DomainObject $domainObject
  * @param boolean $mergeWithExistingClass
  *
  * @return string
  */
 public function generateDomainRepositoryCode(\EBT\ExtensionBuilder\Domain\Model\DomainObject $domainObject, $mergeWithExistingClass)
 {
     $repositoryTemplateClassPath = $this->codeTemplateRootPath . 'Classes/Domain/Repository/Repository.phpt';
     $repositoryClassFileObject = $this->classBuilder->generateRepositoryClassFileObject($domainObject, $repositoryTemplateClassPath, $mergeWithExistingClass);
     if ($repositoryClassFileObject) {
         $this->addLicenseHeader($repositoryClassFileObject->getFirstClass());
         return $this->printerService->renderFileObject($repositoryClassFileObject, TRUE);
     } else {
         throw new \Exception('Class file for repository could not be generated');
     }
 }