예제 #1
0
 /**
  * Prepare models
  *
  * @param State|State $state
  */
 public function prepare(State $state)
 {
     $model = new Model();
     $path = $this->buildPath()->setModule($this->config->getModule())->addPart(basename($this->name))->getRawPath('');
     $model->setPath($path);
     $state->addModel($model, $this->name);
 }
예제 #2
0
 /**
  * @param State           $state
  * @param Model           $model
  * @param OutputInterface $output
  */
 public function mergeConfig(State $state, Model $model, OutputInterface $output)
 {
     $config = $model->getServiceConfig();
     if (is_array($config)) {
         $state->getModuleConfig()->merge($config);
     }
 }
예제 #3
0
 /**
  * Prepare models
  *
  * @param State|State $state
  */
 public function prepare(State $state)
 {
     $model = new Model();
     $name = $this->buildNamespace()->addPart($this->config->getModule())->addPart('Service')->addPart($this->config->getName() . 'Service')->getNamespace();
     $path = $this->buildPath()->setModule($this->config->getModule())->addPart('Service')->addPart($this->config->getName() . 'Service')->getSourcePath();
     $model->setName($name);
     $model->setPath($path);
     $state->addModel($model, 'service');
 }
예제 #4
0
 /**
  * @param State|\Scaffold\State $state
  */
 public function prepare(State $state)
 {
     $model = new Model();
     $name = $this->buildNamespace()->addPart($this->config->getModule() . 'Test')->addPart('Entity')->addPart($this->config->getName() . 'Test')->getNamespace();
     $path = $this->buildPath()->setModule($this->config->getModule())->addPart('Entity')->addPart($this->config->getName())->getTestPath();
     $model->setName($name);
     $model->setPath($path);
     $state->addModel($model, 'entity-test');
     $this->model = $model;
 }
 /**
  * Prepare models
  *
  * @param State|\Scaffold\State $state
  */
 public function prepare(State $state)
 {
     $model = new Model();
     $name = $this->buildNamespace()->addPart($this->config->getModule())->addPart('Repository')->addPart($this->config->getName() . 'RepositoryTrait')->getNamespace();
     $path = $this->buildPath()->setModule($this->config->getModule())->addPart('Repository')->addPart($this->config->getName() . 'RepositoryTrait')->getSourcePath();
     $model->setName($name);
     $model->setPath($path);
     $state->addModel($model, 'repository-trait');
     $this->model = $model;
 }
예제 #6
0
 public function testWriteModelBin()
 {
     $writer = $this->getWriter(['writeData']);
     $model = new Model();
     $model->setPath('Model.php');
     $model->setGenerator(new BinGenerator('Test'));
     $nullOutput = new NullOutput();
     $writer->expects($this->once())->method('writeData')->with('Model.php', 'Test', $nullOutput);
     $writer->writeModel($model, $nullOutput);
 }
예제 #7
0
 /**
  * Prepare models
  *
  * @param State|State $state
  */
 public function prepare(State $state)
 {
     $model = new Model();
     $name = $this->buildNamespace()->addPart($this->config->getModule())->addPart('Module')->getNamespace();
     $pathBuilder = $this->buildPath();
     if ($this->config->getBare()) {
         $pathBuilder->addPart('src');
         $pathBuilder->addPart($this->config->getModule());
     }
     $path = $pathBuilder->setModule($this->config->getModule())->addPart('Module')->getRawPath();
     $model->setName($name);
     $model->setPath($path);
     $state->addModel($model, 'module');
 }
예제 #8
0
 /**
  * Prepare models
  *
  * @param State|State $state
  */
 public function prepare(State $state)
 {
     $filename = $this->config->getName() . 'Controller';
     $model = new Model();
     $name = $this->buildNamespace()->addPart($this->config->getModule())->addPart('Controller')->addPart($filename)->getNamespace();
     $path = $this->buildPath()->setModule($this->config->getModule())->addPart('Controller')->addPart($filename)->getSourcePath();
     $model->setName($name);
     $model->setPath($path);
     $config = array('controllers' => array('invokables' => array($model->getServiceName() => $model->getName())));
     $model->setServiceConfig($config);
     $state->addModel($model, 'controller');
 }
예제 #9
0
 /**
  * Prepare models
  *
  * @param State|\Scaffold\State $state
  */
 public function prepare(State $state)
 {
     $model = new Model();
     $name = $this->buildNamespace()->addPart($this->config->getModule())->addPart('Form')->addPart($this->config->getName() . 'FormFactory')->getNamespace();
     $path = $this->buildPath()->setModule($this->config->getModule())->addPart('Form')->addPart($this->config->getName() . 'FormFactory')->getSourcePath();
     $model->setName($name);
     $model->setPath($path);
     $config = array('service_manager' => array('factories' => array($model->getServiceName() => $name)));
     $model->setServiceConfig($config);
     $state->addModel($model, 'form-factory');
 }
예제 #10
0
 public function testGetServiceNameForControllerWhenModuleSameName()
 {
     $model = new Model();
     $model->setName('User\\Controller\\UserController');
     $this->assertEquals('UserUser', $model->getServiceName());
 }
 /**
  * @param $name
  * @return Model
  */
 public function getModel($name)
 {
     $model = new Model();
     $model->setName($name);
     return $model;
 }
예제 #12
0
 /**
  * Build generators
  *
  * @param State $state
  */
 public function build(State $state)
 {
     $generator = new ClassGenerator($this->model->getName());
     $generator->setExtendedClass($this->extends);
     $this->model->setGenerator($generator);
 }