Esempio n. 1
0
 public function forwardEngineerXmlFile(\blaze\io\File $file)
 {
     $buf = new \blaze\lang\StringBuffer();
     $t = new \blaze\persistence\meta\driver\XmlMetaDriver();
     $cd = $t->parseFile($file);
     $cd->generate($buf);
     $fileName = \blaze\lang\String::asWrapper($cd->getName());
     $fileName = $fileName->substring($fileName->lastIndexOf('\\') + 1);
     $writer = new \blaze\io\output\FileWriter(new \blaze\io\File($this->dir, $fileName . '.php'));
     $writer->write($buf->toString());
     $writer->close();
 }
Esempio n. 2
0
 public function reverseTable(\blaze\ds\meta\TableMetaData $tmd)
 {
     $file = new \blaze\io\File($this->dir, $this->getClassName($tmd->getTableName()) . '.xml');
     $doc = new \DOMDocument('1.0', 'utf-8');
     $class = \blaze\persistence\meta\ClassDescriptor::getClassDescriptor($this->getClassName($tmd->getTableName()));
     $class->setPackage($this->package);
     $class->setTableDescriptor(\blaze\persistence\meta\TableDescriptor::getTableDescriptor($tmd->getTableName()));
     $this->reversePrimaryColumns($class, $tmd->getPrimaryKeys());
     $this->reverseNormalColumns($class, $tmd->getColumns());
     $this->reverseForeignColumns($class, $tmd->getForeignKeys());
     $this->reverseInverseColumns($class, $tmd->getReferencingKeys());
     $t = new \blaze\persistence\meta\driver\XmlMetaDriver();
     $t->save($class, $file);
 }