Esempio n. 1
0
 /**
  *
  * @param Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject
  *
  * @return Tx_ExtensionBuilder_Domain_Model_Class OR NULL
  */
 public function getRepositoryClass(Tx_ExtensionBuilder_Domain_Model_DomainObject $currentDomainObject)
 {
     $extensionDir = $this->previousExtensionDirectory;
     if (isset($this->oldDomainObjects[$currentDomainObject->getUniqueIdentifier()])) {
         $oldDomainObject = $this->oldDomainObjects[$currentDomainObject->getUniqueIdentifier()];
         $fileName = Tx_ExtensionBuilder_Service_CodeGenerator::getFolderForClassFile($extensionDir, 'Repository', FALSE) . $oldDomainObject->getName() . 'Repository.php';
         if (file_exists($fileName)) {
             include_once $fileName;
             $className = $oldDomainObject->getDomainRepositoryClassName();
             $this->classObject = $this->classParser->parse($className);
             if ($oldDomainObject->getName() != $currentDomainObject->getName() || $this->extensionRenamed) {
                 $newClassName = $currentDomainObject->getDomainRepositoryClassName();
                 $this->classObject->setName($newClassName);
                 $this->classObject->setFileName($currentDomainObject->getName() . '_Repository.php');
                 $this->cleanUp(Tx_ExtensionBuilder_Service_CodeGenerator::getFolderForClassFile($extensionDir, 'Repository'), $oldDomainObject->getName() . 'Repository.php');
             }
             return $this->classObject;
         } else {
             t3lib_div::devLog('class file didn\'t exist:' . $fileName, 'extension_builder', 2);
         }
     } else {
         $fileName = Tx_ExtensionBuilder_Service_CodeGenerator::getFolderForClassFile($extensionDir, 'Repository', FALSE) . $currentDomainObject->getName() . 'Repository.php';
         if (file_exists($fileName)) {
             include_once $fileName;
             $className = $currentDomainObject->getDomainRepositoryClassName();
             $this->classObject = $this->classParser->parse($className);
             t3lib_div::devlog('existing Repository class:' . $fileName, 'extension_builder', 0, (array) $this->classObject);
             return $this->classObject;
         }
     }
     t3lib_div::devlog('No existing Repository class:' . $currentDomainObject->getName(), 'extension_builder', 2);
     return NULL;
 }
 /**
  *
  * @param $className
  * @return unknown_type
  */
 protected function parseClass($className)
 {
     $classParser = new Tx_ExtensionBuilder_Utility_ClassParser();
     $classParser->debugMode = $this->debugMode;
     $classObject = $classParser->parse($className);
     $this->assertTrue($classObject instanceof Tx_ExtensionBuilder_Domain_Model_Class_Class);
     $classReflection = new Tx_ExtensionBuilder_Reflection_ClassReflection($className);
     $this->ParserFindsAllConstants($classObject, $classReflection);
     $this->ParserFindsAllMethods($classObject, $classReflection);
     $this->ParserFindsAllProperties($classObject, $classReflection);
     return $classObject;
 }