person: add createdBY, updatedBy fields on Person + migration

This commit is contained in:
nobohan
2021-06-18 10:15:30 +02:00
parent 585a19e803
commit bccaf5ad6e
2 changed files with 105 additions and 2 deletions

View File

@@ -23,9 +23,11 @@ namespace Chill\PersonBundle\Entity;
*/
use ArrayIterator;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\Language;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\MaritalStatus;
use Chill\PersonBundle\Entity\Household\HouseholdMember;
@@ -54,7 +56,7 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
* "person"=Person::class
* })
*/
class Person implements HasCenterInterface
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface
{
/**
* The person's id
@@ -297,6 +299,29 @@ class Person implements HasCenterInterface
*/
private ?int $numberOfChildren = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
*/
private $createdBy;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private \DateTimeInterface $createdAt;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
private User $updatedBy;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private \DateTimeInterface $updatedAt;
/**
* @var boolean
* @deprecated
@@ -1392,4 +1417,37 @@ class Person implements HasCenterInterface
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function setCreatedAt(\DateTimeInterface $datetime): self
{
$this->createdAt = $datetime;
return $this;
}
public function setUpdatedBy(User $user): self
{
$this->updatedBy = $user;
return $this;
}
public function setUpdatedAt(\DateTimeInterface $datetime): self
{
$this->updatedAt = $datetime;
return $this;
}
}