public function asEntity()
    {
        call_user_func($this->callback, $this->propertyName, function (EntityRelation $relation) {
            /** @var IEntityMapper $entityMapper */
            $entityMapper = $relation->getMapper();
            if ($relation instanceof IToOneRelation) {
                return new ToOneRelationObjectReference($entityMapper);
            } else {
                return new ToManyRelationObjectReference($entityMapper);
            }
        });
    }