Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Application\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Zend\InputFilter\Factory as InputFactory;
- use Zend\InputFilter\InputFilter;
- use Zend\InputFilter\InputFilterAwareInterface;
- use Zend\InputFilter\InputFilterInterface;
- use \Application\Entity\AbstractEntity;
- /**
- * @ORM\Entity
- * @ORM\Table(name="quotes")
- */
- class Quote extends AbstractEntity implements InputFilterAwareInterface
- {
- /**
- * @ORM\Column(name="id", type="integer", nullable=false)
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- protected $id;
- /**
- * @ORM\ManyToOne(targetEntity="Service")
- */
- protected $service;
- /**
- * @ORM\Column(name="name", nullable=false)
- */
- protected $name;
- /**
- * @ORM\Column(name="email", nullable=false)
- */
- protected $email;
- /**
- * @ORM\Column(name="phone_number", nullable=false)
- */
- protected $phone_number;
- /**
- * @ORM\Column(name="budget", type="decimal", precision=2, nullable=true)
- */
- protected $budget;
- /**
- * @ORM\Column(name="content", type="text", nullable=false)
- */
- protected $content;
- /**
- * @ORM\Column(name="date_posted", type="datetime")
- */
- protected $date_posted;
- public function setInputFilter(InputFilterInterface $inputFilter)
- {
- $this->inputFilter = $inputFilter;
- }
- public function getInputFilter()
- {
- if (!$this->inputFilter) {
- $inputFilter = new InputFilter();
- $factory = new InputFactory();
- $inputFilter->add($factory->createInput(array(
- 'name' => 'name',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- )));
- $inputFilter->add($factory->createInput(array(
- 'name' => 'email',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array('name' => 'EmailAddress'),
- ),
- )));
- $inputFilter->add($factory->createInput(array(
- 'name' => 'phone_number',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'PhoneNumber',
- 'options' => array(
- 'country' => 'CA',
- 'allowPossible' => true,
- ),
- ),
- ),
- )));
- $inputFilter->add($factory->createInput(array(
- 'name' => 'content',
- 'required' => true,
- 'filters' => array(
- array('name' => 'StripTags'),
- array('name' => 'StringTrim'),
- ),
- 'validators' => array(
- array(
- 'name' => 'StringLength',
- 'options' => array(
- 'encoding' => 'UTF-8',
- 'min' => 20,
- 'max' => 500,
- ),
- ),
- ),
- )));
- $this->inputFilter = $inputFilter;
- }
- return $this->inputFilter;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement