File tree Expand file tree Collapse file tree 3 files changed +36
-30
lines changed
lib/Gedmo/SoftDeleteable/Traits Expand file tree Collapse file tree 3 files changed +36
-30
lines changed Original file line number Diff line number Diff line change 22
33namespace Gedmo \SoftDeleteable \Traits ;
44
5+ use DateTime ;
6+
57/**
6- * SoftDeletable Trait, usable with PHP >= 5.4
8+ * A generic trait to use on your self-deletable entities.
9+ * There is no mapping information defined in this trait.
710 *
811 * @author Wesley van Opdorp <[email protected] > 912 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
1013 */
1114trait SoftDeleteable
1215{
1316 /**
14- * @var \ DateTime
17+ * @var DateTime|null
1518 */
1619 protected $ deletedAt ;
1720
1821 /**
19- * Sets deletedAt.
20- *
21- * @param \DateTime|null $deletedAt
22+ * Set or clear the deleted at timestamp.
2223 *
23- * @return $this
24+ * @return self
2425 */
25- public function setDeletedAt (\ DateTime $ deletedAt = null )
26+ public function setDeletedAt (DateTime $ deletedAt = null )
2627 {
2728 $ this ->deletedAt = $ deletedAt ;
2829
2930 return $ this ;
3031 }
3132
3233 /**
33- * Returns deletedAt.
34+ * Get the deleted at timestamp value. Will return null if
35+ * the entity has not been soft deleted.
3436 *
35- * @return \ DateTime
37+ * @return DateTime|null
3638 */
3739 public function getDeletedAt ()
3840 {
3941 return $ this ->deletedAt ;
4042 }
4143
4244 /**
43- * Is deleted?
45+ * Check if the entity has been soft deleted.
4446 *
4547 * @return bool
4648 */
Original file line number Diff line number Diff line change 22
33namespace Gedmo \SoftDeleteable \Traits ;
44
5+ use DateTime ;
56use Doctrine \ODM \MongoDB \Mapping \Annotations as ODM ;
67
78/**
8- * SoftDeletable Trait, usable with PHP >= 5.4
9+ * A soft deletable trait you can apply to your MongoDB entities.
10+ * Includes default annotation mapping.
911 *
1012 * @author Wesley van Opdorp <[email protected] > 1113 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
1214 */
1315trait SoftDeleteableDocument
1416{
1517 /**
16- * @var \DateTime
1718 * @ODM\Field(type="date")
19+ *
20+ * @var DateTime|null
1821 */
1922 protected $ deletedAt ;
2023
2124 /**
22- * Sets deletedAt.
23- *
24- * @param \DateTime|null $deletedAt
25+ * Set or clear the deleted at timestamp.
2526 *
26- * @return $this
27+ * @return self
2728 */
28- public function setDeletedAt (\ DateTime $ deletedAt = null )
29+ public function setDeletedAt (DateTime $ deletedAt = null )
2930 {
3031 $ this ->deletedAt = $ deletedAt ;
3132
3233 return $ this ;
3334 }
3435
3536 /**
36- * Returns deletedAt.
37+ * Get the deleted at timestamp value. Will return null if
38+ * the entity has not been soft deleted.
3739 *
38- * @return \ DateTime
40+ * @return DateTime|null
3941 */
4042 public function getDeletedAt ()
4143 {
4244 return $ this ->deletedAt ;
4345 }
4446
4547 /**
46- * Is deleted?
48+ * Check if the entity has been soft deleted.
4749 *
4850 * @return bool
4951 */
Original file line number Diff line number Diff line change 22
33namespace Gedmo \SoftDeleteable \Traits ;
44
5+ use DateTime ;
56use Doctrine \ORM \Mapping as ORM ;
67
78/**
8- * SoftDeletable Trait, usable with PHP >= 5.4
9+ * A soft deletable trait you can apply to your Doctrine ORM entities.
10+ * Includes default annotation mapping.
911 *
1012 * @author Wesley van Opdorp <[email protected] > 1113 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
1214 */
1315trait SoftDeleteableEntity
1416{
1517 /**
16- * @var \DateTime
1718 * @ORM\Column(type="datetime", nullable=true)
19+ *
20+ * @var DateTime|null
1821 */
1922 protected $ deletedAt ;
2023
2124 /**
22- * Sets deletedAt.
23- *
24- * @param \DateTime|null $deletedAt
25+ * Set or clear the deleted at timestamp.
2526 *
26- * @return $this
27+ * @return self
2728 */
28- public function setDeletedAt (\ DateTime $ deletedAt = null )
29+ public function setDeletedAt (DateTime $ deletedAt = null )
2930 {
3031 $ this ->deletedAt = $ deletedAt ;
3132
3233 return $ this ;
3334 }
3435
3536 /**
36- * Returns deletedAt.
37+ * Get the deleted at timestamp value. Will return null if
38+ * the entity has not been soft deleted.
3739 *
38- * @return \ DateTime
40+ * @return DateTime|null
3941 */
4042 public function getDeletedAt ()
4143 {
4244 return $ this ->deletedAt ;
4345 }
4446
4547 /**
46- * Is deleted?
48+ * Check if the entity has been soft deleted.
4749 *
4850 * @return bool
4951 */
You can’t perform that action at this time.
0 commit comments