<?phpnamespace App\Daikin\BaseBundle\Entity;use Doctrine\ORM\Mapping as ORM;use JMS\Serializer\Annotation as Serializer;/** * @ORM\MappedSuperclass * @Serializer\ExclusionPolicy("all") */abstract class AbstractDeleteableEntity{ /** @ORM\Column(type="integer", name="deletestatus") */ protected $deletestatus; public function __construct() { $this->deletestatus = 0; } abstract public function setUpdatedAt($updatedAt); abstract public function getUpdatedAt(); abstract public function getId(); /** * Set deletestatus property * * @param integer $deletestatus * @return AbstractDeleteableEntity */ public function setDeletestatus($deletestatus) { $this->deletestatus = (bool)$deletestatus ? 1 : 0; return $this; } /** * Get deletestatus property * * @return integer */ public function getDeletestatus() { return $this->deletestatus; } /** * set deleted status of the entity * * @param boolean $deleted * @return AbstractDeleteableEntity */ public function setDeleted($deleted) { $this->setUpdatedAt(time()); $this->setDeletestatus((bool)$deleted); return $this; } /** * is this entity deleted? * * @return boolean */ public function isDeleted() { return (bool)$this->deletestatus; } /** * may the entity be trashed (deleted set to true)? * * @return boolean */ public function isTrashable() { return true; } /** * may the entity be recoverd (is it in soft-deleted state?) * * @return boolean */ public function isRecoverable() { return $this->isDeleted(); } /** * may the entity be deleted (fully purged from DB)? * * @return boolean */ public function isDeleteable() { return true; }}