src/Entity/AppPersonalAccount.php line 34

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\AppPersonalAccountRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use ApiPlatform\Metadata\ApiFilter;
  10. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Serializer\Annotation\MaxDepth;
  13. use ApiPlatform\Core\Annotation\ApiProperty;
  14. #[ORM\Entity(repositoryClassAppPersonalAccountRepository::class)]
  15. #[ApiResource(
  16.     normalizationContext: ['groups' => ['personalAcc:read']],
  17.     denormalizationContext: ['groups' => ['personalAcc:write']],
  18.     order: ['id' => 'DESC'],
  19. )]
  20. #[ApiFilter(SearchFilter::class, properties: [
  21.     // 'name' => 'ipartial', 
  22.     'owner.id' => 'exact'
  23.     'number' => 'exact'
  24.     'parent.id' => 'exact'
  25.     'main' => 'exact'
  26.     // 'manager.id' => 'exact', 
  27.     // 'manager.firstName' => 'ipartial',
  28.     // 'phone' => 'exact',
  29. ])]
  30. class AppPersonalAccount
  31. {
  32.     #[ORM\Id]
  33.     #[ORM\GeneratedValue]
  34.     #[ORM\Column]
  35.     #[Groups(['personalAcc:read''personalAcc:write''user:read'])]
  36.     private ?int $id null;
  37.     #[ORM\ManyToOne(inversedBy'appPersonalAccounts')]
  38.     #[ORM\JoinColumn(nullablefalse)]
  39.     #[Groups(['personalAcc:read'])]
  40.     private ?User $owner null;
  41.     #[ORM\Column(length100)]
  42.     #[Groups(['personalAcc:read''user:read'])]
  43.     private ?string $number null;
  44.     #[ORM\Column(length255nullabletrue)]
  45.     #[Groups(['personalAcc:read''personalAcc:write''user:read'])]
  46.     private ?string $name null;
  47.     #[ORM\Column(nullabletrue)]
  48.     #[Groups(['personalAcc:read''user:read'])]
  49.     private ?int $numberOfScale null;
  50.     #[ORM\Column(nullabletrue)]
  51.     #[Groups(['personalAcc:read''user:read'])]
  52.     private ?bool $active null;
  53.     #[ORM\OneToMany(mappedBy'personal'targetEntityAppCounterReading::class, cascade:['persist''remove'])]
  54.     #[Groups(['personalAcc:read''user:read'])]
  55.     private Collection $appCounterReadings;
  56.     #[ORM\Column(length255nullabletrue)]
  57.     #[Groups(['personalAcc:read''user:read'])]
  58.     private ?string $fullAddress null;
  59.     #[ORM\Column(length100nullabletrue)]
  60.     #[Groups(['personalAcc:read''user:read'])]
  61.     private ?string $city null;
  62.     #[ORM\Column(length100nullabletrue)]
  63.     #[Groups(['personalAcc:read''user:read'])]
  64.     private ?string $street null;
  65.     #[ORM\Column(length100nullabletrue)]
  66.     #[Groups(['personalAcc:read''user:read'])]
  67.     private ?string $building null;
  68.     #[ORM\Column(length100nullabletrue)]
  69.     #[Groups(['personalAcc:read''user:read'])]
  70.     private ?string $room null;
  71.     #[ORM\Column(length255nullabletrue)]
  72.     #[Groups(['personalAcc:read''user:read'])]
  73.     private ?string $mainFullAddress null;
  74.     #[Groups(['personalAcc:read'])]
  75.     #[ORM\ManyToOne(inversedBy'appPersonalAccounts')]
  76.     private ?Accounts $accounts null;
  77.     #[ORM\OneToMany(mappedBy'personalAccount'targetEntityServiceOrderHistory::class, cascade:['persist'])]
  78.     private Collection $serviceOrderHistories;
  79.     #[Groups(['personalAcc:read''user:read'])]
  80.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'appPersonalAccounts')]
  81.     private ?self $parent null;
  82.     #[ORM\OneToMany(mappedBy'parent'targetEntityself::class, cascade:['remove'])]
  83.     private Collection $appPersonalAccounts;
  84.     #[Groups(['personalAcc:read''user:read'])]
  85.     #[ORM\Column(length100nullabletrue)]
  86.     private ?string $type null;
  87.     #[Groups(['personalAcc:read''user:read'])]
  88.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  89.     private ?\DateTimeInterface $dateEntered null;
  90.     #[Groups(['personalAcc:read''user:read'])]
  91.     #[ORM\Column(nullabletrue)]
  92.     private ?bool $isMain null;
  93.     #[Groups(['personalAcc:read''user:read'])]
  94.     #[ORM\Column(length255nullabletrue)]
  95.     private ?string $eic null;
  96.     #[Groups(['personalAcc:read''user:read'])]
  97.     #[ORM\Column(length255nullabletrue)]
  98.     private ?string $counter null;
  99.     #[Groups(['personalAcc:read''personalAcc:write''user:read'])]
  100.     #[ORM\Column(nullabletrue)]
  101.     private ?bool $isShow null;
  102.     public function __construct()
  103.     {
  104.         $this->appCounterReadings = new ArrayCollection();
  105.         $this->serviceOrderHistories = new ArrayCollection();
  106.         $this->appPersonalAccounts = new ArrayCollection();
  107.     }
  108.     public function getId(): ?int
  109.     {
  110.         return $this->id;
  111.     }
  112.     public function getOwner(): ?User
  113.     {
  114.         return $this->owner;
  115.     }
  116.     public function setOwner(?User $owner): static
  117.     {
  118.         $this->owner $owner;
  119.         return $this;
  120.     }
  121.     public function getNumber(): ?string
  122.     {
  123.         return $this->number;
  124.     }
  125.     public function setNumber(string $number): static
  126.     {
  127.         $this->number $number;
  128.         return $this;
  129.     }
  130.     public function getName(): ?string
  131.     {
  132.         return $this->name;
  133.     }
  134.     public function setName(?string $name): static
  135.     {
  136.         $this->name $name;
  137.         return $this;
  138.     }
  139.     public function getNumberOfScale(): ?int
  140.     {
  141.         return $this->numberOfScale;
  142.     }
  143.     public function setNumberOfScale(?int $numberOfScale): static
  144.     {
  145.         $this->numberOfScale $numberOfScale;
  146.         return $this;
  147.     }
  148.     public function isActive(): ?bool
  149.     {
  150.         return $this->active;
  151.     }
  152.     public function setActive(?bool $active): static
  153.     {
  154.         $this->active $active;
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection<int, AppCounterReading>
  159.      */
  160.     public function getAppCounterReadings(): Collection
  161.     {
  162.         return $this->appCounterReadings;
  163.     }
  164.     public function addAppCounterReading(AppCounterReading $appCounterReading): static
  165.     {
  166.         if (!$this->appCounterReadings->contains($appCounterReading)) {
  167.             $this->appCounterReadings->add($appCounterReading);
  168.             $appCounterReading->setPersonal($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removeAppCounterReading(AppCounterReading $appCounterReading): static
  173.     {
  174.         if ($this->appCounterReadings->removeElement($appCounterReading)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($appCounterReading->getPersonal() === $this) {
  177.                 $appCounterReading->setPersonal(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182.     public function getFullAddress(): ?string
  183.     {
  184.         return $this->fullAddress;
  185.     }
  186.     public function setFullAddress(?string $fullAddress): static
  187.     {
  188.         $this->fullAddress $fullAddress;
  189.         return $this;
  190.     }
  191.     public function getCity(): ?string
  192.     {
  193.         return $this->city;
  194.     }
  195.     public function setCity(?string $city): static
  196.     {
  197.         $this->city $city;
  198.         return $this;
  199.     }
  200.     public function getStreet(): ?string
  201.     {
  202.         return $this->street;
  203.     }
  204.     public function setStreet(?string $street): static
  205.     {
  206.         $this->street $street;
  207.         return $this;
  208.     }
  209.     public function getBuilding(): ?string
  210.     {
  211.         return $this->building;
  212.     }
  213.     public function setBuilding(?string $building): static
  214.     {
  215.         $this->building $building;
  216.         return $this;
  217.     }
  218.     public function getRoom(): ?string
  219.     {
  220.         return $this->room;
  221.     }
  222.     public function setRoom(?string $room): static
  223.     {
  224.         $this->room $room;
  225.         return $this;
  226.     }
  227.     public function getMainFullAddress(): ?string
  228.     {
  229.         return $this->mainFullAddress;
  230.     }
  231.     public function setMainFullAddress(string $mainFullAddress): static
  232.     {
  233.         $this->mainFullAddress $mainFullAddress;
  234.         return $this;
  235.     }
  236.     public function getAccounts(): ?Accounts
  237.     {
  238.         return $this->accounts;
  239.     }
  240.     public function setAccounts(?Accounts $accounts): static
  241.     {
  242.         $this->accounts $accounts;
  243.         return $this;
  244.     }
  245.     /**
  246.      * @return Collection<int, ServiceOrderHistory>
  247.      */
  248.     public function getServiceOrderHistories(): Collection
  249.     {
  250.         return $this->serviceOrderHistories;
  251.     }
  252.     public function addServiceOrderHistory(ServiceOrderHistory $serviceOrderHistory): static
  253.     {
  254.         if (!$this->serviceOrderHistories->contains($serviceOrderHistory)) {
  255.             $this->serviceOrderHistories->add($serviceOrderHistory);
  256.             $serviceOrderHistory->setPersonalAccount($this);
  257.         }
  258.         return $this;
  259.     }
  260.     public function removeServiceOrderHistory(ServiceOrderHistory $serviceOrderHistory): static
  261.     {
  262.         if ($this->serviceOrderHistories->removeElement($serviceOrderHistory)) {
  263.             // set the owning side to null (unless already changed)
  264.             if ($serviceOrderHistory->getPersonalAccount() === $this) {
  265.                 $serviceOrderHistory->setPersonalAccount(null);
  266.             }
  267.         }
  268.         return $this;
  269.     }
  270.     public function getParent(): ?self
  271.     {
  272.         return $this->parent;
  273.     }
  274.     public function setParent(?self $parent): static
  275.     {
  276.         $this->parent $parent;
  277.         return $this;
  278.     }
  279.     /**
  280.      * @return Collection<int, self>
  281.      */
  282.     public function getAppPersonalAccounts(): Collection
  283.     {
  284.         return $this->appPersonalAccounts;
  285.     }
  286.     public function addAppPersonalAccount(self $appPersonalAccount): static
  287.     {
  288.         if (!$this->appPersonalAccounts->contains($appPersonalAccount)) {
  289.             $this->appPersonalAccounts->add($appPersonalAccount);
  290.             $appPersonalAccount->setParent($this);
  291.         }
  292.         return $this;
  293.     }
  294.     public function removeAppPersonalAccount(self $appPersonalAccount): static
  295.     {
  296.         if ($this->appPersonalAccounts->removeElement($appPersonalAccount)) {
  297.             // set the owning side to null (unless already changed)
  298.             if ($appPersonalAccount->getParent() === $this) {
  299.                 $appPersonalAccount->setParent(null);
  300.             }
  301.         }
  302.         return $this;
  303.     }
  304.     public function getType(): ?string
  305.     {
  306.         return $this->type;
  307.     }
  308.     public function setType(?string $type): static
  309.     {
  310.         $this->type $type;
  311.         return $this;
  312.     }
  313.     public function getDateEntered(): ?\DateTimeInterface
  314.     {
  315.         return $this->dateEntered;
  316.     }
  317.     public function setDateEntered(?\DateTimeInterface $dateEntered): static
  318.     {
  319.         $this->dateEntered $dateEntered;
  320.         return $this;
  321.     }
  322.     public function isIsMain(): ?bool
  323.     {
  324.         return $this->isMain;
  325.     }
  326.     public function setIsMain(?bool $isMain): static
  327.     {
  328.         $this->isMain $isMain;
  329.         return $this;
  330.     }
  331.     public function getEic(): ?string
  332.     {
  333.         return $this->eic;
  334.     }
  335.     public function setEic(?string $eic): static
  336.     {
  337.         $this->eic $eic;
  338.         return $this;
  339.     }
  340.     public function getCounter(): ?string
  341.     {
  342.         return $this->counter;
  343.     }
  344.     public function setCounter(?string $counter): static
  345.     {
  346.         $this->counter $counter;
  347.         return $this;
  348.     }
  349.     public function isIsShow(): ?bool
  350.     {
  351.         return $this->isShow;
  352.     }
  353.     public function setIsShow(?bool $isShow): static
  354.     {
  355.         $this->isShow $isShow;
  356.         return $this;
  357.     }
  358. }