Created
October 18, 2019 11:06
-
-
Save OwlyCode/a188766f0fb741ff24bdd3e8994805a1 to your computer and use it in GitHub Desktop.
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
<?php | |
namespace App\Entity\Traits; | |
use App\Entity\User; | |
use Doctrine\ORM\Mapping as ORM; | |
use Gedmo\Mapping\Annotation as Gedmo; | |
trait BlameableTrait | |
{ | |
/** | |
* @Gedmo\Blameable(on="create") | |
* @ORM\ManyToOne(targetEntity="User") | |
* @ORM\JoinColumn(name="created_by", referencedColumnName="id") | |
*/ | |
protected $createdBy; | |
/** | |
* @Gedmo\Blameable(on="update") | |
* @ORM\ManyToOne(targetEntity="User") | |
* @ORM\JoinColumn(name="updated_by", referencedColumnName="id") | |
*/ | |
protected $updatedBy; | |
public function setCreatedBy(User $createdBy): self | |
{ | |
$this->createdBy = $createdBy; | |
return $this; | |
} | |
public function getCreatedBy(): ?User | |
{ | |
return $this->createdBy; | |
} | |
public function setUpdatedBy(User $updatedBy): self | |
{ | |
$this->updatedBy = $updatedBy; | |
return $this; | |
} | |
public function getUpdatedBy(): ?User | |
{ | |
return $this->updatedBy; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment