forked from doctrine-extensions/DoctrineExtensions
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Traits without annotations for easy integration purposes.
- Loading branch information
1 parent
b1c3643
commit 3cc1c10
Showing
8 changed files
with
292 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Gedmo\Blameable\Traits; | ||
|
||
/** | ||
* Blameable Trait, usable with PHP >= 5.4 | ||
* | ||
* @author David Buchmann <[email protected]> | ||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
*/ | ||
trait Blameable | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $createdBy; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $updatedBy; | ||
|
||
/** | ||
* Sets createdBy. | ||
* | ||
* @param string $createdBy | ||
* @return $this | ||
*/ | ||
public function setCreatedBy($createdBy) | ||
{ | ||
$this->createdBy = $createdBy; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns createdBy. | ||
* | ||
* @return string | ||
*/ | ||
public function getCreatedBy() | ||
{ | ||
return $this->createdBy; | ||
} | ||
|
||
/** | ||
* Sets updatedBy. | ||
* | ||
* @param string $updatedBy | ||
* @return $this | ||
*/ | ||
public function setUpdatedBy($updatedBy) | ||
{ | ||
$this->updatedBy = $updatedBy; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns updatedBy. | ||
* | ||
* @return string | ||
*/ | ||
public function getUpdatedBy() | ||
{ | ||
return $this->updatedBy; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Gedmo\IpTraceable\Traits; | ||
|
||
/** | ||
* IpTraceable Trait, usable with PHP >= 5.4 | ||
* | ||
* @author Pierre-Charles Bertineau <[email protected]> | ||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
*/ | ||
trait IpTraceable | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $createdFromIp; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $updatedFromIp; | ||
|
||
/** | ||
* Sets createdFromIp. | ||
* | ||
* @param string $createdFromIp | ||
* @return $this | ||
*/ | ||
public function setCreatedFromIp($createdFromIp) | ||
{ | ||
$this->createdFromIp = $createdFromIp; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns createdFromIp. | ||
* | ||
* @return string | ||
*/ | ||
public function getCreatedFromIp() | ||
{ | ||
return $this->createdFromIp; | ||
} | ||
|
||
/** | ||
* Sets updatedFromIp. | ||
* | ||
* @param string $updatedFromIp | ||
* @return $this | ||
*/ | ||
public function setUpdatedFromIp($updatedFromIp) | ||
{ | ||
$this->updatedFromIp = $updatedFromIp; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns updatedFromIp. | ||
* | ||
* @return string | ||
*/ | ||
public function getUpdatedFromIp() | ||
{ | ||
return $this->updatedFromIp; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Gedmo\SoftDeleteable\Traits; | ||
|
||
/** | ||
* SoftDeletable Trait, usable with PHP >= 5.4 | ||
* | ||
* @author Wesley van Opdorp <[email protected]> | ||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
*/ | ||
trait SoftDeleteable | ||
{ | ||
/** | ||
* @var \DateTime | ||
*/ | ||
protected $deletedAt; | ||
|
||
/** | ||
* Sets deletedAt. | ||
* | ||
* @param \Datetime|null $deletedAt | ||
* | ||
* @return $this | ||
*/ | ||
public function setDeletedAt(\DateTime $deletedAt = null) | ||
{ | ||
$this->deletedAt = $deletedAt; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns deletedAt. | ||
* | ||
* @return \DateTime | ||
*/ | ||
public function getDeletedAt() | ||
{ | ||
return $this->deletedAt; | ||
} | ||
|
||
/** | ||
* Is deleted? | ||
* | ||
* @return bool | ||
*/ | ||
public function isDeleted() | ||
{ | ||
return null !== $this->deletedAt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Gedmo\Timestampable\Traits; | ||
|
||
/** | ||
* Timestampable Trait, usable with PHP >= 5.4 | ||
* | ||
* @author Gediminas Morkevicius <[email protected]> | ||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
*/ | ||
trait Timestampable | ||
{ | ||
/** | ||
* @var \DateTime | ||
*/ | ||
protected $createdAt; | ||
|
||
/** | ||
* @var \DateTime | ||
*/ | ||
protected $updatedAt; | ||
|
||
/** | ||
* Sets createdAt. | ||
* | ||
* @param \DateTime $createdAt | ||
* @return $this | ||
*/ | ||
public function setCreatedAt(\DateTime $createdAt) | ||
{ | ||
$this->createdAt = $createdAt; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns createdAt. | ||
* | ||
* @return \DateTime | ||
*/ | ||
public function getCreatedAt() | ||
{ | ||
return $this->createdAt; | ||
} | ||
|
||
/** | ||
* Sets updatedAt. | ||
* | ||
* @param \DateTime $updatedAt | ||
* @return $this | ||
*/ | ||
public function setUpdatedAt(\DateTime $updatedAt) | ||
{ | ||
$this->updatedAt = $updatedAt; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Returns updatedAt. | ||
* | ||
* @return \DateTime | ||
*/ | ||
public function getUpdatedAt() | ||
{ | ||
return $this->updatedAt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Gedmo\Tree\Traits; | ||
|
||
/** | ||
* NestedSet Trait, usable with PHP >= 5.4 | ||
* | ||
* @author Renaat De Muynck <[email protected]> | ||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
*/ | ||
trait NestedSet | ||
{ | ||
|
||
/** | ||
* @var integer | ||
*/ | ||
private $root; | ||
|
||
/** | ||
* @var integer | ||
*/ | ||
private $level; | ||
|
||
/** | ||
* @var integer | ||
*/ | ||
private $left; | ||
|
||
/** | ||
* @var integer | ||
*/ | ||
private $right; | ||
|
||
} |