Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439 Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
57 lines
1.1 KiB
PHP
57 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Gedmo\SoftDeleteable\Traits;
|
|
|
|
use DateTime;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* A soft deletable trait you can apply to your Doctrine ORM entities.
|
|
* Includes default annotation mapping.
|
|
*
|
|
* @author Wesley van Opdorp <wesley.van.opdorp@freshheads.com>
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
*/
|
|
trait SoftDeleteableEntity
|
|
{
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*
|
|
* @var DateTime|null
|
|
*/
|
|
protected $deletedAt;
|
|
|
|
/**
|
|
* Set or clear the deleted at timestamp.
|
|
*
|
|
* @return self
|
|
*/
|
|
public function setDeletedAt(DateTime $deletedAt = null)
|
|
{
|
|
$this->deletedAt = $deletedAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get the deleted at timestamp value. Will return null if
|
|
* the entity has not been soft deleted.
|
|
*
|
|
* @return DateTime|null
|
|
*/
|
|
public function getDeletedAt()
|
|
{
|
|
return $this->deletedAt;
|
|
}
|
|
|
|
/**
|
|
* Check if the entity has been soft deleted.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function isDeleted()
|
|
{
|
|
return null !== $this->deletedAt;
|
|
}
|
|
}
|