Repository URL to install this package:
|
Version:
6.3.0 ▾
|
<?php
namespace DigitalAscetic\FileBundle\Entity\File;
use DigitalAscetic\BaseEntityBundle\Entity\BaseEntity;
use DigitalAscetic\BaseEntityBundle\Entity\Entity;
use DigitalAscetic\SharedEntityBundle\Entity\BaseSharedEntity;
use Symfony\Component\Serializer\Annotation\Ignore;
abstract class AbstractManagedFile extends BaseSharedEntity implements Entity
{
public function getId(): ?int
{
return $this->id;
}
#[Ignore]
public static function isEntity($object)
{
return ($object instanceof Entity);
}
#[Ignore]
public static function isArrayOfEntities($object)
{
return (is_array($object) && (count($object) > 0) && BaseEntity::isEntity(reset($object)));
}
#[Ignore]
public static function isEntityOrArrayOfEntities($object)
{
return (BaseEntity::isEntity($object) || BaseEntity::isArrayOfEntities($object));
}
#[Ignore]
public function isPersisted(): bool
{
return is_numeric($this->id);
}
#[Ignore]
public function isNotPersisted(): bool
{
return !$this->isPersisted();
}
#[Ignore]
public function isSameEntity(Entity $entity): bool
{
return $this->isPersisted() && ($entity->getId() === $this->id);
}
}