Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Cadastro\Form;
- use Cadastro\Entity\EncargoValor;
- use Doctrine\Common\Persistence\ObjectManager;
- use DoctrineModule\Stdlib\Hydrator\DoctrineObject;
- use Zend\Form\Fieldset;
- use Zend\InputFilter\InputFilterProviderInterface;
- use Application\Filter\StrToFloat;
- class EncargoValorFieldset extends Fieldset implements InputFilterProviderInterface
- {
- public function __construct(ObjectManager $objectManager)
- {
- parent::__construct('valor');
- $this->setHydrator(new DoctrineObject($objectManager))->setObject(new EncargoValor());
- $this->add(array(
- 'type' => 'Cadastro\Form\Element\Money',
- 'name' => 'valorInicial',
- 'options' => array(
- 'label' => 'Valor inicial'
- ),
- 'attributes' => array(
- 'class' => 'form-control money'
- )
- ));
- $this->add(array(
- 'type' => 'Cadastro\Form\Element\Money',
- 'name' => 'valorFinal',
- 'options' => array(
- 'label' => 'Valor final'
- ),
- 'attributes' => array(
- 'class' => 'form-control money'
- )
- ));
- $this->add(array(
- 'type' => 'Cadastro\Form\Element\Money',
- 'name' => 'valorEncargo',
- 'options' => array(
- 'label' => 'Valor encargo'
- ),
- 'attributes' => array(
- 'class' => 'form-control money'
- )
- ));
- }
- /**
- * (non-PHPdoc)
- *
- * @see \Application\Model\Model::getInputFilter()
- */
- public function getInputFilterSpecification()
- {
- return [
- 'id' => [
- 'required' => false
- ],
- 'valorInicial' => [
- 'filters' => [
- new StrToFloat()
- ]
- ],
- 'valorFinal' => [
- 'filters' => [
- new StrToFloat()
- ]
- ],
- 'valorEncargo' => [
- 'filters' => [
- new StrToFloat()
- ]
- ]
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement