src/Entity/Client.php line 44
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use ApiPlatform\Metadata\Get;use ApiPlatform\Metadata\Patch;use ApiPlatform\Metadata\Post;use App\Controller\Legacy\UserInfoController;//use App\Dto\UserResetOutputPasswordDto;use App\Entity\Traits\CreatedAtTrait;use App\Entity\Traits\UpdatedAtTrait;use App\Repository\ClientRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;//use App\State\UserPatchStateProcessor;//use App\State\UserPostStateProcessor;//use App\State\UserResetPasswordProcessor;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints\Email;use Symfony\Component\Validator\Constraints\Length;use Symfony\Component\Validator\Constraints\NotBlank;#[ORM\HasLifecycleCallbacks]#[ORM\Entity(repositoryClass: ClientRepository::class)]#[ApiResource(operations: [new Get(uriTemplate: '/user/profile',controller: UserInfoController::class,normalizationContext: ['groups' => ['client:profile']],security: "is_granted('ROLE_CLIENT')",read: false),new Get()],paginationEnabled: false)]class Client implements UserInterface, PasswordAuthenticatedUserInterface{use CreatedAtTrait;use UpdatedAtTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['client:profile'])]private ?int $id = null;#[ORM\Column(length: 180, unique: true)]#[Groups(['client:profile'])]#[NotBlank]#[Email]private ?string $email = null;#[ORM\Column(length: 255)]private ?string $address = null;#[ORM\Column]#[Groups(['client:profile'])]private array $roles = [];/*** @var string|null The hashed password*/#[ORM\Column]private ?string $password = null;private ?string $plainPassword = null;#[ORM\ManyToMany(targetEntity: Terminal::class, mappedBy: 'clients')]private Collection $terminals;#[ORM\OneToMany(mappedBy: 'client', targetEntity: Feedback::class, orphanRemoval: true)]private Collection $feedbacks;#[ORM\Column(length: 255)]#[Groups(['client:profile'])]#[NotBlank]#[Length(min: 1, max: 255)]private ?string $company = null;#[ORM\Column(length: 30, nullable: true)]#[Groups(['client:profile'])]#[Length(min: 0, max: 30)]private ?string $taxId = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $comment = null;#[ORM\OneToMany(mappedBy: 'client', targetEntity: Projects::class, cascade: ['all'])]#[Groups(['client:profile'])]private Collection $projects;#[ORM\OneToMany(mappedBy: 'client', targetEntity: Media::class)]#[Groups(['client:profile'])]private Collection $medias;public function __toString(): string{return $this->email;}public function __construct(){$this->terminals = new ArrayCollection();$this->feedbacks = new ArrayCollection();$this->projects = new ArrayCollection();$this->medias = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getAddress(): ?string{return $this->address;}public function setAddress(?string $address): static{$this->address = $address;return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string)$this->email;}/*** @see UserInterface*/public function getRoles(): array{$roles = $this->roles;// guarantee every user at least has ROLE_USER$roles[] = 'ROLE_USER';return array_unique($roles);}public function setRoles(array $roles): self{$this->roles = $roles;return $this;}/*** @see PasswordAuthenticatedUserInterface*/public function getPassword(): string{return $this->password;}public function setPassword(string $password): self{$this->password = $password;return $this;}public function getPlainPassword(): ?string{return $this->plainPassword;}public function setPlainPassword(?string $plainPassword): self{$this->plainPassword = $plainPassword;return $this;}/*** @see UserInterface*/public function eraseCredentials(){// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}/*** @return Collection<int, Terminal>*/public function getTerminals(): Collection{return $this->terminals;}public function addTerminal(Terminal $terminal): self{if (!$this->terminals->contains($terminal)) {$this->terminals->add($terminal);$terminal->addClient($this);}return $this;}public function removeTerminal(Terminal $terminal): self{if ($this->terminals->removeElement($terminal)) {$terminal->removeClient($this);}return $this;}/*** @return Collection<int, Feedback>*/public function getFeedbacks(): Collection{return $this->feedbacks;}public function addFeedback(Feedback $feedback): self{if (!$this->feedbacks->contains($feedback)) {$this->feedbacks->add($feedback);$feedback->setClient($this);}return $this;}public function removeFeedback(Feedback $feedback): self{if ($this->feedbacks->removeElement($feedback)) {// set the owning side to null (unless already changed)if ($feedback->getClient() === $this) {$feedback->setClient(null);}}return $this;}public function getCompany(): ?string{return $this->company;}public function setCompany(string $company): self{$this->company = $company;return $this;}public function getTaxId(): ?string{return $this->taxId;}public function setTaxId(?string $taxId): self{$this->taxId = $taxId;return $this;}public function getComment(): ?string{return $this->comment;}public function setComment(?string $comment): self{$this->comment = $comment;return $this;}/*** @return Collection<int, Projects>*/public function getProjects(): Collection{return $this->projects;}public function addProject(Projects $project): static{if (!$this->projects->contains($project)) {$this->projects->add($project);$project->setClient($this);}return $this;}public function removeProject(Projects $project): static{if ($this->projects->removeElement($project)) {// set the owning side to null (unless already changed)if ($project->getClient() === $this) {$project->setClient(null);}}return $this;}/*** @return Collection<int, Media>*/public function getMedias(): Collection{return $this->medias;}public function addMedia(Media $media): static{if (!$this->medias->contains($media)) {$this->medias->add($media);$media->setClient($this);}return $this;}public function removeMedia(Media $media): static{if ($this->medias->removeElement($media)) {// set the owning side to null (unless already changed)if ($media->getClient() === $this) {$media->setClient(null);}}return $this;}}