src/Entity/UserProfile.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserProfileRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. #[ORM\Entity(repositoryClassUserProfileRepository::class)]
  9. class UserProfile
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\OneToOne(targetEntityUser::class, inversedBy'userProfile'cascade: ['persist''remove'])]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private $user;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private $biography;
  20.     #[ORM\Column(type'string'length1000nullabletrue)]
  21.     private $picture;
  22.     #[ORM\Column(type'datetime'nullabletrue)]
  23.     #[Assert\Date]
  24.     private $dateOfBirth;
  25.     #[ORM\Column(type'string'length255nullabletrue)]
  26.     private $address;
  27.     #[ORM\Column(type'string'length255nullabletrue)]
  28.     private $city;
  29.     #[ORM\Column(type'string'length255nullabletrue)]
  30.     private $postalCode;
  31.     #[ORM\Column(type'string'length255nullabletrue)]
  32.     private $country;
  33.     #[ORM\ManyToMany(targetEntityTheme::class)]
  34.     private $themes;
  35.     #[ORM\Column(type'string'length1000nullabletrue)]
  36.     private $internalBiography;
  37.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  38.     private $isPublic;
  39.     #[ORM\Column(type'string'length255nullabletrue)]
  40.     private $phoneNumber;
  41.     public function __toString()
  42.     {
  43.         return 'profile: '.$this->user->getUsername();
  44.     }
  45.     public function __construct()
  46.     {
  47.         $this->themes = new ArrayCollection();
  48.         $this->isPublic false;
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getUser(): ?User
  55.     {
  56.         return $this->user;
  57.     }
  58.     public function setUser(User $user): self
  59.     {
  60.         $this->user $user;
  61.         return $this;
  62.     }
  63.     public function getBiography(): ?string
  64.     {
  65.         return $this->biography;
  66.     }
  67.     public function setBiography(?string $biography): self
  68.     {
  69.         $this->biography $biography;
  70.         return $this;
  71.     }
  72.     public function getDomains(): ?array
  73.     {
  74.         return $this->domains;
  75.     }
  76.     public function setDomains(array $domains): self
  77.     {
  78.         $this->domains $domains;
  79.         return $this;
  80.     }
  81.     public function getPicture(): ?string
  82.     {
  83.         return $this->picture;
  84.     }
  85.     public function setPicture(?string $picture): self
  86.     {
  87.         $this->picture $picture;
  88.         return $this;
  89.     }
  90.     public function getDateOfBirth(): ?\DateTimeInterface
  91.     {
  92.         return $this->dateOfBirth;
  93.     }
  94.     public function setDateOfBirth(?\DateTimeInterface $dateOfBirth): self
  95.     {
  96.         $this->dateOfBirth $dateOfBirth;
  97.         return $this;
  98.     }
  99.     public function getAddress(): ?string
  100.     {
  101.         return $this->address;
  102.     }
  103.     public function setAddress(?string $address): self
  104.     {
  105.         $this->address $address;
  106.         return $this;
  107.     }
  108.     public function getCity(): ?string
  109.     {
  110.         return $this->city;
  111.     }
  112.     public function setCity(?string $city): self
  113.     {
  114.         $this->city $city;
  115.         return $this;
  116.     }
  117.     public function getPostalCode(): ?string
  118.     {
  119.         return $this->postalCode;
  120.     }
  121.     public function setPostalCode(?string $postalCode): self
  122.     {
  123.         $this->postalCode $postalCode;
  124.         return $this;
  125.     }
  126.     public function getCountry(): ?string
  127.     {
  128.         return $this->country;
  129.     }
  130.     public function setCountry(?string $country): self
  131.     {
  132.         $this->country $country;
  133.         return $this;
  134.     }
  135.     /**
  136.      * @return Collection|Theme[]
  137.      */
  138.     public function getThemes(): Collection
  139.     {
  140.         return $this->themes;
  141.     }
  142.     public function setThemes(Collection $themes): self
  143.     {
  144.         if (count(
  145.             array_filter($themes->toArray(), function ($item) {
  146.                 return !($item instanceof Theme);
  147.             })
  148.         ) > 0) {
  149.             $this->themes $themes;
  150.         }
  151.         return $this;
  152.     }
  153.     public function addTheme(Theme $theme): self
  154.     {
  155.         if (!$this->themes->contains($theme)) {
  156.             $this->themes[] = $theme;
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeTheme(Theme $theme): self
  161.     {
  162.         $this->themes->removeElement($theme);
  163.         return $this;
  164.     }
  165.     public function getInternalBiography(): ?string
  166.     {
  167.         return $this->internalBiography;
  168.     }
  169.     public function setInternalBiography(?string $internalBiography): self
  170.     {
  171.         $this->internalBiography $internalBiography;
  172.         return $this;
  173.     }
  174.     public function getIsPublic(): ?bool
  175.     {
  176.         return $this->isPublic;
  177.     }
  178.     public function setIsPublic(bool $isPublic): self
  179.     {
  180.         $this->isPublic $isPublic;
  181.         return $this;
  182.     }
  183.     public function getPhoneNumber(): ?string
  184.     {
  185.         return $this->phoneNumber;
  186.     }
  187.     public function setPhoneNumber(?string $phoneNumber): self
  188.     {
  189.         $this->phoneNumber $phoneNumber;
  190.         return $this;
  191.     }
  192. }