context = DatabaseConnection::i()->getContext(); $this->table = $this->context->table($this->tableName); } function toEntity(?ActiveRow $ar) { $entityName = "openvk\\Web\\Models\\Entities\\$this->modelName"; return is_null($ar) ? NULL : new $entityName($ar); } function get(int $id) { return $this->toEntity($this->table->get($id)); } use \Nette\SmartObject; }