mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
use trait to implement TrackCreationInterface and TrackUpdateInterface
This commit is contained in:
parent
c70a4dc664
commit
7af7135971
@ -12,7 +12,9 @@ declare(strict_types=1);
|
|||||||
namespace Chill\PersonBundle\Entity\Person;
|
namespace Chill\PersonBundle\Entity\Person;
|
||||||
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||||
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
@ -34,23 +36,14 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||||||
*/
|
*/
|
||||||
class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
|
use TrackCreationTrait;
|
||||||
|
use TrackUpdateTrait;
|
||||||
/**
|
/**
|
||||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||||
* @Groups({"read"})
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private CommentEmbeddable $comment;
|
private CommentEmbeddable $comment;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime")
|
|
||||||
*/
|
|
||||||
private $createdAt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
|
||||||
* @ORM\JoinColumn(nullable=false)
|
|
||||||
*/
|
|
||||||
private User $createdBy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text", nullable=true)
|
* @ORM\Column(type="text", nullable=true)
|
||||||
* @Groups({"read"})
|
* @Groups({"read"})
|
||||||
@ -92,16 +85,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
*/
|
*/
|
||||||
private ?ThirdParty $thirdParty = null;
|
private ?ThirdParty $thirdParty = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="datetime", nullable=true)
|
|
||||||
*/
|
|
||||||
private $updatedAt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
|
||||||
*/
|
|
||||||
private User $updatedBy;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->comment = new CommentEmbeddable();
|
$this->comment = new CommentEmbeddable();
|
||||||
@ -112,16 +95,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
return $this->comment;
|
return $this->comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreatedAt(): ?DateTimeInterface
|
|
||||||
{
|
|
||||||
return $this->createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCreatedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFreeText(): ?string
|
public function getFreeText(): ?string
|
||||||
{
|
{
|
||||||
return $this->freeText;
|
return $this->freeText;
|
||||||
@ -155,16 +128,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
return $this->thirdParty;
|
return $this->thirdParty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdatedAt(): ?DateTimeInterface
|
|
||||||
{
|
|
||||||
return $this->updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUpdatedBy(): ?User
|
|
||||||
{
|
|
||||||
return $this->updatedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setComment(?CommentEmbeddable $comment): self
|
public function setComment(?CommentEmbeddable $comment): self
|
||||||
{
|
{
|
||||||
if (null === $comment) {
|
if (null === $comment) {
|
||||||
@ -178,23 +141,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCreatedAt(DateTimeInterface $createdAt): self
|
|
||||||
{
|
|
||||||
$this->createdAt = $createdAt;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedBy(?User $createdBy): self
|
|
||||||
{
|
|
||||||
$this->createdBy = $createdBy;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SETTERS.
|
|
||||||
*/
|
|
||||||
public function setFreeText(?string $freeText): self
|
public function setFreeText(?string $freeText): self
|
||||||
{
|
{
|
||||||
$this->freeText = $freeText;
|
$this->freeText = $freeText;
|
||||||
@ -249,20 +195,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdatedAt(DateTimeInterface $updatedAt): self
|
|
||||||
{
|
|
||||||
$this->updatedAt = $updatedAt;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUpdatedBy(?User $updatedBy): self
|
|
||||||
{
|
|
||||||
$this->updatedBy = $updatedBy;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Assert\Callback
|
* @Assert\Callback
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user