/** * @param mixed $person * * @throws \LogicException * @return PhoneNumber */ public function setPerson(Person $person) { if ($this->person !== null && $this->person->getId() != $person->getId()) { throw new \LogicException('This phone number is already linked to a person'); } $this->person = $person; return $this; }
/** * @return BaseInputFilter */ public function getInputFilter() { if (!$this->inputFilter) { $this->inputFilter = parent::getInputFilter(); } return $this->inputFilter; }
/** * @return InputFilterInterface * @codeCoverageIgnore */ public function getInputFilter() { if (!$this->inputFilter) { $inputFilter = parent::getInputFilter(); $factory = new InputFactory(); $inputFilter->add($factory->createInput(array('name' => 'cases', 'required' => true, 'validators' => array(array('name' => 'Callback', 'options' => array('messages' => array(Callback::INVALID_VALUE => 'This person needs an attached case', Callback::INVALID_CALLBACK => "An error occurred in the validation"), 'callback' => function () { return $this->hasAttachedCase(); })))))); $this->inputFilter->merge($inputFilter); } return $this->inputFilter; }