Mongolid\DataMapper\EntityAssembler::morphingTime PHP Method

morphingTime() protected method

Returns the return of polymorph method of the given entity if available.
See also: Mongolid\Model\PolymorphableInterface::polymorph
See also: https://i.ytimg.com/vi/TFGN9kAjdis/maxresdefault.jpg
protected morphingTime ( mixed $entity ) : mixed
$entity mixed The entity that may or may not have a polymorph method.
return mixed The result of $entity->polymorph or the $entity itself.
    protected function morphingTime($entity)
    {
        if ($entity instanceof PolymorphableInterface) {
            return $entity->polymorph();
        }
        return $entity;
    }