Mongolid\DataMapper\EntityAssembler::morphingTime PHP Méthode

morphingTime() protected méthode

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.
Résultat mixed The result of $entity->polymorph or the $entity itself.
    protected function morphingTime($entity)
    {
        if ($entity instanceof PolymorphableInterface) {
            return $entity->polymorph();
        }
        return $entity;
    }