Beispiel #1
0
 /**
  * @return Normgen
  */
 public function create()
 {
     $normgen = new Normgen($this->config, $this->analyser);
     if ($this->config->get('generator.generate.strategy') === Config::STRATEGY_TOGETHER) {
         $resolver = new SimpleTogetherResolver($this->config);
     } else {
         if ($this->config->get('generator.generate.strategy') === Config::STRATEGY_SEPARATE) {
             $resolver = new SimpleSeparateResolver($this->config);
         } else {
             throw new InvalidStrategyException();
         }
     }
     $normgen->setEntityGenerator(new EntityGenerator($this->config, $resolver));
     $normgen->setRepositoryGenerator(new RepositoryGenerator($this->config, $resolver));
     $normgen->setMapperGenerator(new MapperGenerator($this->config, $resolver));
     $normgen->setFacadeGenerator(new FacadeGenerator($this->config, $resolver));
     return $normgen;
 }
Beispiel #2
0
 /**
  * Generate ORM
  */
 public function generate()
 {
     $database = $this->analyser->analyse();
     if ($this->config->get('generator.generate.entities')) {
         $this->entityGenerator->generate($database);
     }
     if ($this->config->get('generator.generate.repositories')) {
         $this->repositoryGenerator->generate($database);
     }
     if ($this->config->get('generator.generate.mappers')) {
         $this->mapperGenerator->generate($database);
     }
     if ($this->config->get('generator.generate.facades')) {
         $this->facadeGenerator->generate($database);
     }
 }
Beispiel #3
0
 /**
  * Generate file
  *
  * @param string $filename
  * @param string $code
  */
 protected function generateFile($filename, $code)
 {
     FileSystem::write($this->config->get('output') . DIRECTORY_SEPARATOR . $filename, "<?php\n\n{$code}");
 }