/**
  * Generates the code for the repository class
  * Either from domainRepository template or from class partial
  *
  * @param Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject
  * @param boolean $mergeWithExistingClass
  */
 public function generateDomainRepositoryCode(Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject, $mergeWithExistingClass)
 {
     $repositoryClassObject = $this->classBuilder->generateRepositoryClassObject($domainObject, $mergeWithExistingClass);
     if ($repositoryClassObject) {
         $classDocComment = $this->renderDocComment($repositoryClassObject, $domainObject);
         $repositoryClassObject->setDocComment($classDocComment);
         return $this->renderTemplate('Classes/class.phpt', array('domainObject' => $domainObject, 'classObject' => $repositoryClassObject));
     } else {
         throw new Exception('Class file for repository could not be generated');
     }
 }