getRelatedClassPath() public method

Get the related class file path by the given class name.
public getRelatedClassPath ( string $class ) : string
$class string the scheam related class name
return string the class filepath.
Esempio n. 1
0
 /**
  * This method checks the exising schema file and the generated class file mtime.
  * If the schema file is newer or the forceUpdate flag is specified, then 
  * the generated class files should be updated.
  *
  * @param ClassTemplate\ClassFile $cTemplate
  * @param DeclareSchema           $schema
  */
 protected function updateClassFile(ClassFile $cTemplate, DeclareSchema $schema, $canOverwrite = false)
 {
     // always update the proxy schema file
     $classFilePath = $schema->getRelatedClassPath($cTemplate->getShortClassName());
     // classes not Model/Collection class are overwriteable
     if (file_exists($classFilePath)) {
         if ($canOverwrite && ($schema->isNewerThanFile($classFilePath) || $this->forceUpdate)) {
             $this->writeClassTemplateToPath($cTemplate, $classFilePath);
             return [$cTemplate->getClassName(), $classFilePath];
         }
     } else {
         if ($this->writeClassTemplateToPath($cTemplate, $classFilePath)) {
             return [$cTemplate->getClassName(), $classFilePath];
         }
     }
 }
Esempio n. 2
0
 /**
  * This method checks the exising schema file and the generated class file mtime.
  * If the schema file is newer or the forceUpdate flag is specified, then 
  * the generated class files should be updated.
  *
  * @param ClassTemplate\ClassFile $cTemplate
  * @param DeclareSchema $schema
  */
 public function updateClassFile(ClassFile $cTemplate, DeclareSchema $schema, $overwrite = false)
 {
     // always update the proxy schema file
     $classFilePath = $schema->getRelatedClassPath($cTemplate->getShortClassName());
     // classes not Model/Collection class are overwriteable
     if (!file_exists($classFilePath)) {
         $this->writeClassTemplateToPath($cTemplate, $classFilePath, $overwrite);
         $this->logger->info2(" - Creating {$classFilePath}");
         return array($cTemplate->getClassName(), $classFilePath);
     } elseif ($schema->isNewerThanFile($classFilePath) || $this->forceUpdate) {
         if ($this->writeClassTemplateToPath($cTemplate, $classFilePath, $overwrite)) {
             $this->logger->info2(" - Updating {$classFilePath}");
             return array($cTemplate->getClassName(), $classFilePath);
         } else {
             $this->logger->info2(" - Skipping {$classFilePath}");
         }
     } else {
         $this->logger->info2(" - Skipping {$classFilePath}");
     }
 }