Beispiel #1
0
 public function __construct(Table $table, Cluster $cluster, $outputFilename = null, array $options = array())
 {
     if (!empty($options)) {
         $this->setOptions($options);
     }
     Log::info('Generate part mode ' . $table->getName());
     $this->_table = $table;
     $file = new FileGenerator();
     $this->setFile($file);
     $file->setNamespace('Model');
     $class = new ClassGenerator();
     $file->setClass($class);
     $file->addUse('Model\\Result\\Result');
     $file->addUse('Model\\Entity\\' . $table->getNameAsCamelCase() . 'Entity');
     $file->addUse('Model\\Cond\\' . $table->getNameAsCamelCase() . 'Cond', 'Cond');
     $file->addUse('Model\\Cond\\AbstractCond');
     $file->addUse('Model\\Collection\\' . $table->getNameAsCamelCase() . 'Collection');
     $this->_runPlugins(self::PART_MODEL, self::RUNTIME_PRE);
     $class->setName('Abstract' . $table->getNameAsCamelCase() . 'Model');
     if ($table->isTree() && $this->hasPlugin('Tree', AbstractPart::PART_MODEL)) {
         $class->setExtendedClass('\\Model\\Mysql\\TreeModel');
     } else {
         $class->setExtendedClass('\\Model\\Mysql\\AbstractModel');
     }
     $class->setAbstract(true);
     $this->_runPlugins(self::PART_MODEL, self::RUNTIME_POST);
     if ($outputFilename) {
         file_put_contents($outputFilename, $file->generate());
     }
 }
Beispiel #2
0
 public function __construct(Table $table, Cluster $cluster, $outputFilename = null)
 {
     Log::info('Generate part front collection ' . $table->getName());
     $this->_table = $table;
     $file = new \Model\Code\Generator\FileGenerator();
     $this->setFile($file);
     $class = new \Zend\Code\Generator\ClassGenerator();
     $file->setClass($class);
     $this->_runPlugins(self::PART_FRONT_COLLECTION, self::RUNTIME_PRE);
     $class->setNamespaceName('Model\\Collection');
     $class->setName($table->getNameAsCamelCase() . 'Collection');
     $class->setExtendedClass('Abstract' . $table->getNameAsCamelCase() . 'Collection');
     $this->_runPlugins(self::PART_FRONT_COLLECTION, self::RUNTIME_POST);
     if ($outputFilename) {
         file_put_contents($outputFilename, $file->generate());
     }
 }
Beispiel #3
0
 public function __construct(Table $table, Schema $cluster, $outputFilename = null)
 {
     Log::info('Generate part entity ' . $table->getName());
     $this->_table = $table;
     $file = new \Model\Code\Generator\FileGenerator();
     $class = new \Zend\Code\Generator\ClassGenerator();
     $file->setClass($class);
     $this->setFile($file);
     $this->_runPlugins(self::PART_ENTITY_ABSTRACT, self::RUNTIME_PRE);
     $class->setName($table->getNameAsCamelCase() . 'EntityAbstract');
     $class->setExtendedClass('\\Model\\Entity');
     $this->_runPlugins(self::PART_ENTITY_ABSTRACT, self::RUNTIME_POST);
     if ($outputFilename) {
         file_put_contents($outputFilename, $file->generate());
     }
 }
Beispiel #4
0
 public function __construct(Table $table, Cluster $cluster, $outputFilename = null)
 {
     Log::debug('Generate part list ' . $table->getName());
     $this->_table = $table;
     $file = new FileGenerator();
     $this->setFile($file);
     $class = new ClassGenerator();
     $file->setClass($class);
     $file->setNamespace('Model\\Collection');
     //$file->setUse('Model\ResultList');
     $this->_runPlugins(self::PART_COLLECTION, self::RUNTIME_PRE);
     $class->setName('Abstract' . $table->getNameAsCamelCase() . 'Collection');
     $class->setExtendedClass('AbstractCollection');
     $class->setAbstract(true);
     $this->_runPlugins(self::PART_COLLECTION, self::RUNTIME_POST);
     if ($outputFilename) {
         file_put_contents($outputFilename, $file->generate());
     }
 }