Ejemplo n.º 1
0
 public function testDocBlockGetterAndSetter()
 {
     $docblockGenerator = new \Zend\Code\Generator\DocBlockGenerator();
     $method = new MethodGenerator();
     $method->setDocBlock($docblockGenerator);
     $this->assertTrue($docblockGenerator === $method->getDocBlock());
 }
Ejemplo n.º 2
0
 protected function buildDelete(ClassGenerator $generator, State $state)
 {
     $body = '$this->getEntityManager()->remove($model);';
     $method = new MethodGenerator('delete');
     $method->setParameter(new ParameterGenerator('model', $state->getEntityModel()->getClassName()));
     $method->setDocBlock(new DocBlockGenerator());
     $method->getDocBlock()->setTag(new Tag\GenericTag('param', $state->getEntityModel()->getClassName() . ' $model'));
     $method->setBody($body);
     $generator->addMethodFromGenerator($method);
 }
Ejemplo n.º 3
0
    public function buildGetInputFilter(ClassGenerator $generator, State $state)
    {
        $method = new MethodGenerator('getInputFilter');
        $method->setDocBlock(new DocBlockGenerator());
        $method->getDocBlock()->setTag(['name' => 'return', 'description' => 'InputFilterInterface']);
        $method->setBody(<<<EOF
return (new Factory())->createInputFilter(
    array(

    )
);
EOF
);
        $generator->addMethodFromGenerator($method);
    }
Ejemplo n.º 4
0
 /**
  * @param  string                               $name
  * @param  string                               $type
  * @return \Zend\Code\Generator\MethodGenerator
  */
 protected function getSetter($name, $type)
 {
     $method = new MethodGenerator('set' . ucfirst($name));
     $method->setParameter(new ParameterGenerator($name, $type));
     $method->setDocBlock(new DocBlockGenerator());
     $method->getDocBlock()->setTag(new Tag\GenericTag('param', $type . ' $' . $name));
     $method->setBody('$this->' . $name . ' = $' . $name . ';');
     return $method;
 }