/**
  * @return RegistryClassPattern
  **/
 public function build(MetaClass $class)
 {
     $userFile = $class->getPath() . $class->getName() . EXT_CLASS;
     if (MetaConfiguration::me()->isForcedGeneration() || !file_exists($userFile)) {
         $this->dumpFile($userFile, Format::indentize(RegistryClassBuilder::build($class)));
     }
     return $this;
 }
Example #2
0
 /**
  * @return MetaConfiguration
  **/
 public function buildContainers()
 {
     $force = $this->isForcedGeneration();
     $out = $this->getOutput();
     $out->infoLine('Building containers: ');
     foreach ($this->classes as $class) {
         foreach ($class->getProperties() as $property) {
             if ($property->getRelation() && $property->getRelationId() != MetaRelation::ONE_TO_ONE) {
                 $userFile = HESPER_META_DAO_DIR . $class->getName() . ucfirst($property->getName()) . 'DAO' . EXT_CLASS;
                 if ($force || !file_exists($userFile)) {
                     BasePattern::dumpFile($userFile, Format::indentize(ContainerClassBuilder::buildContainer($class, $property)));
                 }
                 // check for old-style naming
                 $oldStlye = HESPER_META_DAO_DIR . $class->getName() . 'To' . $property->getType()->getClassName() . 'DAO' . EXT_CLASS;
                 if (is_readable($oldStlye)) {
                     $out->newLine()->error('remove manually: ' . $oldStlye);
                 }
             }
         }
     }
     return $this;
 }
Example #3
0
 /**
  * @return BasePattern
  **/
 protected function buildDao(MetaClass $class)
 {
     $this->dumpFile(HESPER_META_AUTO_DAO_DIR . 'Auto' . $class->getName() . 'DAO' . EXT_CLASS, Format::indentize(AutoDaoBuilder::build($class)));
     $userFile = HESPER_META_DAO_DIR . $class->getName() . 'DAO' . EXT_CLASS;
     if (MetaConfiguration::me()->isForcedGeneration() || !file_exists($userFile)) {
         $this->dumpFile($userFile, Format::indentize(DaoBuilder::build($class)));
     }
     return $this;
 }