<?php
namespace App\Entity;
use App\Repository\AddressRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Action\NotFoundAction;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ApiResource(
* security= "is_granted('ROLE_MANAGER')",
* normalizationContext={"groups"={"address:read"}, "swagger_definition_name"="Read"},
* denormalizationContext={"groups"={"address:write"},"swagger_definition_name"="Write", "skip_null_values" = true},
* itemOperations={
* "get"={
* "path"="/adresses/{id}",
* "controller"=NotFoundAction::class,
* "read"=false,
* "output"=false,
* },
* },
* collectionOperations={
* "get"={
* "path"="/adresses",
* "controller"=NotFoundAction::class,
* "read"=false,
* "output"=false,
* },
* },
* attributes={
* "pagination_items_per_page"=10,
* "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
* }
* )
*
* @ORM\Entity(repositoryClass=AddressRepository::class)
* @ORM\HasLifecycleCallbacks
*
*/
class Address
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*
* @Groups({
* "directory:collaborator:search",
* "directory:people:search",
* "contact:read",
* "mandate:read",
* "property:read",
* "recommandation:read",
* "agent:read",
* "transaction-item:read",
* "business-indication:item:read"
* })
*/
private $id;
/**
* @ORM\Column(type="text", nullable=true)
* @Assert\Type("string")
* @Groups({
* "directory:collaborator:search",
* "directory:people:search",
* "agent:read","siege:put","siege:write","abstract-collaborator:put",
* "candidate:write","candidate:read","candidate:put",
* "contact:read","contact:write","contact:put",
* "property:read","property:write","property:put",
* "prescriber:read","prescriber:write","prescriber:put",
* "recommandation:read",
* "mandate:read",
* "transaction-item:read",
* "business-indication:item:read"
* })
*
*/
private ?string $firstAddress;
/**
* @ORM\Column(type="text", nullable=true)
* @Assert\Type("string")
* @Groups({
* "directory:collaborator:search",
* "directory:people:search",
* "agent:read","siege:put","siege:write","abstract-collaborator:put",
* "candidate:write","candidate:read",
* "contact:read","contact:write","contact:put",
* "property:read","property:write","property:put",
* "prescriber:read","prescriber:write","prescriber:put",
* "recommandation:read",
* "mandate:read",
* "transaction-item:read",
* "business-indication:item:read"
* })
*/
private ?string $secondAddress = null;
/**
* @ORM\Column(type="text", nullable=true)
* @Assert\Type("string")
* @Groups({
* "directory:collaborator:search",
* "directory:people:search",
* "agent:read","siege:put","siege:write","abstract-collaborator:put",
* "candidate:write","candidate:read",
* "contact:read","contact:write","contact:put",
* "property:read","property:write","property:put",
* "prescriber:read","prescriber:write","prescriber:put",
* "recommandation:read",
* "mandate:read",
* "transaction-item:read",
* "business-indication:item:read"
* })
*/
private ?string $contactCity = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({
* "directory:collaborator:search",
* "directory:people:search",
* "agent:read","siege:put","siege:write","abstract-collaborator:put",
* "candidate:write","candidate:read",
* "contact:read","contact:write","contact:put",
* "property:read","property:write","property:put",
* "prescriber:read","prescriber:write","prescriber:put",
* "recommandation:read",
* "mandate:read",
* "transaction-item:read",
* "business-indication:item:read"
* })
*/
private ?string $zipCode = null;
/**
* @ORM\ManyToOne(targetEntity=City::class, inversedBy="addresses")
* @ORM\JoinColumn(nullable=true)
* @Assert\NotBlank
* @Groups({
* "directory:collaborator:search",
* "directory:people:search",
* "agent:read","siege:put","abstract-collaborator:put","siege:write",
* "candidate:write","candidate:read","candidate:put",
* "contact:read","contact:write","contact:put",
* "property:read","property:write","property:put",
* "prescriber:read","prescriber:write","prescriber:put",
* "recommandation:read",
* "mandate:read",
* "transaction-item:read",
* "business-indication:item:read"
* })
*/
private ?City $city = null;
/**
* @ORM\ManyToOne(targetEntity=Country::class)
* @Groups({
* "contact:read","contact:write","contact:put",
* "agent:read","siege:write",
* "prescriber:read","prescriber:write","prescriber:put"
* })
*/
private ?Country $country;
public function __construct()
{
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstAddress(): ?string
{
return $this->firstAddress;
}
public function setFirstAddress(?string $firstAddress): self
{
$this->firstAddress = $firstAddress;
return $this;
}
public function getSecondAddress(): ?string
{
return $this->secondAddress;
}
public function setSecondAddress(?string $secondAddress): self
{
$this->secondAddress = $secondAddress;
return $this;
}
/**
* @return string|null
*/
public function getContactCity(): ?string
{
return $this->contactCity;
}
/**
* @param string|null $contactCity
*
* @return $this
*/
public function setContactCity(?string $contactCity): self
{
$this->contactCity = $contactCity;
return $this;
}
public function getZipCode(): ?string
{
return $this->zipCode;
}
public function setZipCode(?string $zipCode): self
{
$this->zipCode = $zipCode;
return $this;
}
public function getCity(): ?City
{
return $this->city;
}
public function setCity(?City $city): self
{
$this->city = $city;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
}