/** * Magic method for reading properties. * This method is overriden to provide read access to the foreign objects via * the key names declared in the RELATIONS array. * @param string property name * @return mixed property value. * @since 3.1.2 */ public function __get($name) { if ($this->hasRecordRelation($name) && !$this->canGetProperty($name)) { $this->fetchResultsFor($name); return $this->{$name}; } return parent::__get($name); }