/**
  * Creates an DBSchema object - an object representation of database schema based on ORM-related
  * entity graph
  *
  * @return DBSchema
  */
 function build()
 {
     foreach ($this->ormDomain->getClasses() as $class) {
         if (!$class->hasDao()) {
             continue;
         }
         $this->ormClass = $class;
         $this->importClass($class);
         $this->ormClass = null;
     }
     foreach ($this->ormDomain->getClasses() as $class) {
         if (!$class->hasDao()) {
             continue;
         }
         $this->ormClass = $class;
         $this->dbTable = $this->dbSchema->getTable($this->ormClass->getTable());
         $this->ormIdentifier = $class->getIdentifier();
         foreach ($class->getProperties() as $property) {
             if ($this->ormIdentifier !== $property) {
                 $this->ormProperty = $property;
                 $this->importProperty();
                 $this->ormProperty = null;
             }
         }
         $this->ormClass = $class;
     }
     return $this->dbSchema;
 }
Пример #2
0
 /**
  * Generats auxiliary classes for ORM-related entities defined within the domain
  *
  * @param OrmDomain $ormDomain
  *
  * @return void
  */
 function generate(OrmDomain $ormDomain)
 {
     foreach ($ormDomain->getClasses() as $class) {
         $this->generateClassFiles($class);
     }
 }