public function afterValidate() { switch ($this->application_type_id) { case OphTrOperationnote_Antimetabolite_Application_Type::SPONGE: if (is_null($this->duration)) { $this->addError('duration', '{attribute} cannot be blank'); } if (is_null($this->number)) { $this->addError('number', '{attribute} cannot be blank'); } if (is_null($this->washed)) { $this->addError('washed', '{attribute} cannot be blank'); } $this->volume_id = null; break; case OphTrOperationnote_Antimetabolite_Application_Type::INJECTION: if (is_null($this->volume_id)) { $this->addError('volume_id', '{attribute} cannot be blank'); } $this->duration = null; $this->number = null; $this->washed = null; break; } parent::afterValidate(); }
public function afterValidate() { if ($this->hasMultiSelectValue('difficulties', 'Other')) { if (!$this->difficulty_other) { $this->addError('difficulty_other', $this->getAttributeLabel('difficulty_other') . ' cannot be blank.'); } } if ($this->hasMultiSelectValue('complications', 'Other')) { if (!$this->complication_other) { $this->addError('complication_other', $this->getAttributeLabel('complication_other') . ' cannot be blank.'); } } return parent::afterValidate(); }