protected function resolvePatient() { if (!isset($this->_patient)) { $this->_patient = property_exists($this, 'PatientId') ? $this->PatientId->getModel() : null; } return $this->_patient; }