public function checkValidity($data, $omitMandatoryCheck = false)
{
if (!$omitMandatoryCheck && $this->getMandatory() && ($data === null || $data->getValue() === null || $data->getUnitId() === null)) {
throw new Model\Element\ValidationException("Empty mandatory field [ " . $this->getName() . " ]");
}
if (!empty($data)) {
$value = $data->getValue();
if (!empty($value) && !is_numeric($data->getValue()) || !$data->getUnitId()) {
throw new Model\Element\ValidationException("Invalid dimension unit data " . $this->getName());
}
}
}