public function __get($name) { if ($this->getRelationManager()->isRelationExists($name)) { // resolve relation return $this->getRelationManager()->getRelated($name); } else { // get document parameter return parent::__get($name); } }