src/Entity/Address.php line 43

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AddressRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use ApiPlatform\Core\Annotation\ApiResource;
  7. use ApiPlatform\Core\Action\NotFoundAction;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ApiResource(
  11.  *     security= "is_granted('ROLE_MANAGER')",
  12.  *     normalizationContext={"groups"={"address:read"}, "swagger_definition_name"="Read"},
  13.  *     denormalizationContext={"groups"={"address:write"},"swagger_definition_name"="Write", "skip_null_values" = true},
  14.  *     itemOperations={
  15.  *         "get"={
  16.  *             "path"="/adresses/{id}",
  17.  *             "controller"=NotFoundAction::class,
  18.  *             "read"=false,
  19.  *             "output"=false,
  20.  *         },
  21.  *     },
  22.  *     collectionOperations={
  23.  *         "get"={
  24.  *             "path"="/adresses",
  25.  *             "controller"=NotFoundAction::class,
  26.  *             "read"=false,
  27.  *             "output"=false,
  28.  *         },
  29.  *     },
  30.  *     attributes={
  31.  *          "pagination_items_per_page"=10,
  32.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
  33.  *     }
  34.  * )
  35.  *
  36.  * @ORM\Entity(repositoryClass=AddressRepository::class)
  37.  * @ORM\HasLifecycleCallbacks
  38.  *
  39.  */
  40. class Address
  41. {
  42.     /**
  43.      * @ORM\Id
  44.      * @ORM\GeneratedValue
  45.      * @ORM\Column(type="integer")
  46.      *
  47.      * @Groups({
  48.      *   "directory:collaborator:search",
  49.      *   "directory:people:search",
  50.      *   "contact:read",
  51.      *   "mandate:read",
  52.      *   "property:read",
  53.      *   "recommandation:read",
  54.      *   "agent:read",
  55.      *   "transaction-item:read",
  56.      *   "business-indication:item:read"
  57.      * })
  58.      */
  59.     private $id;
  60.     /**
  61.      * @ORM\Column(type="text", nullable=true)
  62.      * @Assert\Type("string")
  63.      * @Groups({
  64.      *   "directory:collaborator:search",
  65.      *   "directory:people:search",
  66.      *   "agent:read","siege:put","siege:write","abstract-collaborator:put",
  67.      *   "candidate:write","candidate:read","candidate:put",
  68.      *   "contact:read","contact:write","contact:put",
  69.      *   "property:read","property:write","property:put",
  70.      *   "prescriber:read","prescriber:write","prescriber:put",
  71.      *   "recommandation:read",
  72.      *   "mandate:read",
  73.      *   "transaction-item:read",
  74.      *   "business-indication:item:read"
  75.      * })
  76.      *
  77.      */
  78.     private ?string $firstAddress;
  79.     /**
  80.      * @ORM\Column(type="text", nullable=true)
  81.      * @Assert\Type("string")
  82.      * @Groups({
  83.      *    "directory:collaborator:search",
  84.      *    "directory:people:search",
  85.      *    "agent:read","siege:put","siege:write","abstract-collaborator:put",
  86.      *    "candidate:write","candidate:read",
  87.      *    "contact:read","contact:write","contact:put",
  88.      *    "property:read","property:write","property:put",
  89.      *    "prescriber:read","prescriber:write","prescriber:put",
  90.      *    "recommandation:read",
  91.      *    "mandate:read",
  92.      *    "transaction-item:read",
  93.      *    "business-indication:item:read"
  94.      * })
  95.      */
  96.     private ?string $secondAddress null;
  97.     /**
  98.      * @ORM\Column(type="text", nullable=true)
  99.      * @Assert\Type("string")
  100.      * @Groups({
  101.      *    "directory:collaborator:search",
  102.      *    "directory:people:search",
  103.      *    "agent:read","siege:put","siege:write","abstract-collaborator:put",
  104.      *    "candidate:write","candidate:read",
  105.      *    "contact:read","contact:write","contact:put",
  106.      *    "property:read","property:write","property:put",
  107.      *    "prescriber:read","prescriber:write","prescriber:put",
  108.      *    "recommandation:read",
  109.      *    "mandate:read",
  110.      *    "transaction-item:read",
  111.      *    "business-indication:item:read"
  112.      * })
  113.      */
  114.     private ?string $contactCity null;
  115.     /**
  116.      * @ORM\Column(type="string", length=255, nullable=true)
  117.      * @Groups({
  118.      *    "directory:collaborator:search",
  119.      *    "directory:people:search",
  120.      *    "agent:read","siege:put","siege:write","abstract-collaborator:put",
  121.      *    "candidate:write","candidate:read",
  122.      *    "contact:read","contact:write","contact:put",
  123.      *    "property:read","property:write","property:put",
  124.      *    "prescriber:read","prescriber:write","prescriber:put",
  125.      *    "recommandation:read",
  126.      *    "mandate:read",
  127.      *    "transaction-item:read",
  128.      *    "business-indication:item:read"
  129.      * })
  130.      */
  131.     private ?string $zipCode null;
  132.     /**
  133.      * @ORM\ManyToOne(targetEntity=City::class, inversedBy="addresses")
  134.      * @ORM\JoinColumn(nullable=true)
  135.      * @Assert\NotBlank
  136.      * @Groups({
  137.      *    "directory:collaborator:search",
  138.      *    "directory:people:search",
  139.      *    "agent:read","siege:put","abstract-collaborator:put","siege:write",
  140.      *    "candidate:write","candidate:read","candidate:put",
  141.      *    "contact:read","contact:write","contact:put",
  142.      *    "property:read","property:write","property:put",
  143.      *    "prescriber:read","prescriber:write","prescriber:put",
  144.      *    "recommandation:read",
  145.      *    "mandate:read",
  146.      *    "transaction-item:read",
  147.      *    "business-indication:item:read"
  148.      * })
  149.      */
  150.     private ?City $city null;
  151.     /**
  152.      * @ORM\ManyToOne(targetEntity=Country::class)
  153.      * @Groups({
  154.      *   "contact:read","contact:write","contact:put",
  155.      *   "agent:read","siege:write",
  156.      *   "prescriber:read","prescriber:write","prescriber:put"
  157.      * })
  158.      */
  159.     private ?Country $country;
  160.     public function __construct()
  161.     {
  162.     }
  163.     public function getId(): ?int
  164.     {
  165.         return $this->id;
  166.     }
  167.     public function getFirstAddress(): ?string
  168.     {
  169.         return $this->firstAddress;
  170.     }
  171.     public function setFirstAddress(?string $firstAddress): self
  172.     {
  173.         $this->firstAddress $firstAddress;
  174.         return $this;
  175.     }
  176.     public function getSecondAddress(): ?string
  177.     {
  178.         return $this->secondAddress;
  179.     }
  180.     public function setSecondAddress(?string $secondAddress): self
  181.     {
  182.         $this->secondAddress $secondAddress;
  183.         return $this;
  184.     }
  185.     /**
  186.      * @return string|null
  187.      */
  188.     public function getContactCity(): ?string
  189.     {
  190.         return $this->contactCity;
  191.     }
  192.     /**
  193.      * @param string|null $contactCity
  194.      *
  195.      * @return $this
  196.      */
  197.     public function setContactCity(?string $contactCity): self
  198.     {
  199.         $this->contactCity $contactCity;
  200.         return $this;
  201.     }
  202.     public function getZipCode(): ?string
  203.     {
  204.         return $this->zipCode;
  205.     }
  206.     public function setZipCode(?string $zipCode): self
  207.     {
  208.         $this->zipCode $zipCode;
  209.         return $this;
  210.     }
  211.     public function getCity(): ?City
  212.     {
  213.         return $this->city;
  214.     }
  215.     public function setCity(?City $city): self
  216.     {
  217.         $this->city $city;
  218.         return $this;
  219.     }
  220.     public function getCountry(): ?Country
  221.     {
  222.         return $this->country;
  223.     }
  224.     public function setCountry(?Country $country): self
  225.     {
  226.         $this->country $country;
  227.         return $this;
  228.     }
  229. }