/** * Build generators * * @param State|State $state */ public function build(State $state) { $model = $state->getModel($this->name); $data = file_get_contents(SCAFFOLD_ROOT . "/data/template/" . $this->name); $data = str_replace('__NAMESPACE_PLACEHOLDER__', ucfirst($this->config->getModule()), $data); $model->setGenerator(new BinGenerator($data)); }
/** * @return string */ public function getPath() { $builder = new PathBuilder($this->config); $builder->setModule($this->config->getModule()); $builder->addPart('config'); $builder->addPart('service.config'); return $builder->getRawPath(); }
/** * 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'); }
/** * 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; }
/** * 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'); }
/** * Build generators * * @param State|State $state */ public function build(State $state) { $model = $state->getModel('module'); if ($this->config->getBare()) { $data = file_get_contents(SCAFFOLD_ROOT . "/data/template/src/Module.bare.php"); } else { $data = file_get_contents(SCAFFOLD_ROOT . "/data/template/src/Module.php"); } $data = str_replace('__NAMESPACE_PLACEHOLDER__', ucfirst($this->config->getModule()), $data); $data = substr($data, 7); $model->setGenerator(new RawGenerator($data)); }
/** * 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'); }