public checkValidity ( mixed $data, boolean $omitMandatoryCheck = false ) | ||
$data | mixed | |
$omitMandatoryCheck | boolean |
public function checkValidity($data, $omitMandatoryCheck = false)
{
if (!$omitMandatoryCheck and $this->getMandatory() and empty($data)) {
throw new Model\Element\ValidationException("Empty mandatory field [ " . $this->getName() . " ]");
}
if (!empty($data)) {
$persona = Tool\Targeting\Persona::getById($data);
if (!$persona instanceof Tool\Targeting\Persona) {
throw new Model\Element\ValidationException("Invalid persona reference");
}
}
}