create() public static method

public static create ( DeclareSchema $schema, $baseClass )
$schema LazyRecord\Schema\DeclareSchema
コード例 #1
0
 public function generateSchema(SchemaInterface $schema, $overwrite = false)
 {
     $classMap = array();
     $cTemplates = array();
     $cTemplates[] = BaseModelClassFactory::create($schema, $this->getBaseModelClass());
     $cTemplates[] = SchemaProxyClassFactory::create($schema);
     $cTemplates[] = BaseCollectionClassFactory::create($schema, $this->getBaseCollectionClass());
     foreach ($cTemplates as $cTemplate) {
         if ($result = $this->updateClassFile($cTemplate, $schema, $overwrite)) {
             list($className, $classFile) = $result;
             $classMap[$className] = $classFile;
         }
     }
     if ($result = $this->generateCollectionClass($schema, false)) {
         list($className, $classFile) = $result;
         $classMap[$className] = $classFile;
     }
     if ($result = $this->generateModelClass($schema, false)) {
         list($className, $classFile) = $result;
         $classMap[$className] = $classFile;
     }
     return $classMap;
 }
コード例 #2
0
ファイル: SchemaGenerator.php プロジェクト: azole/LazyRecord
 public function generateBaseModelClass(DeclareSchema $schema)
 {
     $cTemplate = BaseModelClassFactory::create($schema, $this->getBaseModelClass());
     return $this->updateClassFile($cTemplate, $schema, true);
 }
コード例 #3
0
 public function generateSchemaFiles(SchemaInterface $schema)
 {
     $classMap = array();
     $cTemplates = array();
     // always update schema proxy and base classes
     $cTemplates[] = SchemaProxyClassFactory::create($schema);
     $cTemplates[] = BaseModelClassFactory::create($schema, $this->getBaseModelClass());
     $cTemplates[] = BaseCollectionClassFactory::create($schema, $this->getBaseCollectionClass());
     foreach ($cTemplates as $cTemplate) {
         if ($result = $this->updateClassFile($cTemplate, $schema, true)) {
             list($className, $classFile) = $result;
             $classMap[$className] = $classFile;
         }
     }
     if ($result = $this->generateCollectionClass($schema)) {
         list($className, $classFile) = $result;
         $classMap[$className] = $classFile;
     }
     if ($result = $this->generateModelClass($schema)) {
         list($className, $classFile) = $result;
         $classMap[$className] = $classFile;
     }
     return $classMap;
 }