This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<?php
namespace Gedmo\SoftDeleteable\Traits;
use DateTime;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
/**
* A soft deletable trait you can apply to your MongoDB 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 SoftDeleteableDocument
{
/**
* @ODM\Field(type="date")
*
* @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;
}
}