/** * {@inheritdoc} See DataEntity class. * * ODM: Get instance of Collection or Document associated with described aggregation. * * Example: * $parentGroup = $user->group(); * echo $user->posts()->where(['published' => true])->count(); * * @return mixed|AccessorInterface|DocumentSelector|Document[]|Document * @throws DocumentException */ public function __call($offset, array $arguments) { if (!isset($this->odmSchema()[ODM::D_AGGREGATIONS][$offset])) { //Field getter/setter return parent::__call($offset, $arguments); } return $this->aggregate($offset); }