public function __get($key)
{
// checking entity attributes
if (isset($this->{$key})) {
return parent::__get($key);
}
// checking relations
if ($this->issetRelation($key)) {
return $this->getRelation($key);
}
throw new Exception('Error ' . $key . ' is not set.');
}