protected function getClassDocBlock(State $state) { $repository = $state->getRepositoryModel()->getName(); $doc = new DocBlockGenerator(); $doc->setTag(new Tag\GenericTag('ORM\\Entity(repositoryClass="' . $repository . '")')); $doc->setTag(new Tag\GenericTag('ORM\\Table(name="' . strtolower($this->config->getName()) . '")')); return $doc; }
/** * Build method factory * * @param ClassGenerator $generator */ public function buildFactory(ClassGenerator $generator) { $docBlock = new DocBlockGenerator('@return ' . $this->config->getName()); $factory = new MethodGenerator(); $factory->setDocBlock($docBlock); $factory->setName('factory'); $factory->setBody('return new ' . $this->config->getName() . '();'); $generator->addMethodFromGenerator($factory); }
/** * 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; }
/** * @param State|State $state */ public function prepare(State $state) { $model = new Model(); $name = $this->buildNamespace()->addPart($this->config->getModule() . 'Test')->addPart('Service')->addPart($this->config->getName() . 'ServiceTest')->getNamespace(); $path = $this->buildPath()->setModule($this->config->getModule())->addPart('Service')->addPart($this->config->getName() . 'Service')->getTestPath(); $model->setName($name); $model->setPath($path); $state->addModel($model, 'service-test'); $this->model = $model; }
/** * Build method factory * * @param ClassGenerator $generator * @param \Scaffold\State $state */ public function buildFactory(ClassGenerator $generator, State $state) { $repository = ucfirst($state->getRepositoryModel()->getClassName()); $docBlock = new DocBlockGenerator(); $docBlock->setTag(new Tag\GenericTag('return', $this->config->getName())); $factory = new MethodGenerator(); $factory->setDocBlock($docBlock); $factory->setName('factory'); $factory->setBody('return $this->get' . $repository . '()->factory();'); $generator->addMethodFromGenerator($factory); }
/** * 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'); }
/** * 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'); }