| 1: | <?php |
| 2: | namespace TIC\DormBundle\Traits; |
| 3: | |
| 4: | use Doctrine\ORM\Mapping as ORM; |
| 5: | |
| 6: | /** |
| 7: | * Gestion des champs createdBy et updatedBy d'une entité Doctrine. |
| 8: | * |
| 9: | * Alternative sans nécessiter ni extension Doctrine, ni bundle tiers, |
| 10: | * tels que Gedmo et StofDoctrineExtensionsBundle. |
| 11: | * @see Gedmo\Timestampable\Traits\BlameableEntity; |
| 12: | * |
| 13: | * ATTENTION: aucune prise en charge automatique ! |
| 14: | */ |
| 15: | trait EntityBlameable |
| 16: | { |
| 17: | /** |
| 18: | * @ORM\Column(type="string") |
| 19: | */ |
| 20: | private $createdBy; |
| 21: | |
| 22: | /** |
| 23: | * @ORM\Column(type="string", nullable=true) |
| 24: | */ |
| 25: | private $updatedBy; |
| 26: | |
| 27: | // --------------------------------------------------------------------- Accessors (getters) |
| 28: | |
| 29: | /** |
| 30: | * Get the creation author. |
| 31: | */ |
| 32: | public function getCreatedBy(): ?string |
| 33: | { |
| 34: | return $this->createdBy; |
| 35: | } |
| 36: | |
| 37: | /** |
| 38: | * Get the modification author. |
| 39: | */ |
| 40: | public function getUpdatedBy(): ?string |
| 41: | { |
| 42: | return $this->updatedBy; |
| 43: | } |
| 44: | |
| 45: | // --------------------------------------------------------------------- Mutators (setters) |
| 46: | |
| 47: | /** |
| 48: | * Set the creation author. |
| 49: | */ |
| 50: | public function setCreatedBy(?string $createdBy): self |
| 51: | { |
| 52: | $this->createdBy = $createdBy; |
| 53: | return $this; |
| 54: | } |
| 55: | |
| 56: | /** |
| 57: | * Set the modification author. |
| 58: | */ |
| 59: | public function setUpdatedBy(?string $updatedBy): self |
| 60: | { |
| 61: | $this->updatedBy = $updatedBy; |
| 62: | return $this; |
| 63: | } |
| 64: | |
| 65: | } |
| 66: |