<?php namespace Lc\CaracoleBundle\Model\Address; use Doctrine\ORM\Mapping as ORM; use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; use Lc\SovBundle\Doctrine\Extension\StatusInterface; use Lc\SovBundle\Doctrine\Extension\StatusTrait; use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; use Lc\SovBundle\Model\User\UserInterface; /** * @ORM\MappedSuperclass() */ abstract class AddressModel extends AbstractLightEntity implements StatusInterface, AddressInterface { use StatusTrait; const TYPE_INDIVIDUAL = 'individual'; const TYPE_LEGAL_PERSON = 'legal-person'; /** * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="addresses") * @ORM\JoinColumn(nullable=true, onDelete="cascade") */ protected $user; /** * @ORM\Column(type="string", length=255) */ protected $title; /** * @ORM\Column(type="string", length=31) */ protected $type; /** * @ORM\Column(type="boolean", nullable=true) */ protected $civility; /** * @ORM\Column(type="string", length=127, nullable=true) */ protected $lastname; /** * @ORM\Column(type="string", length=127, nullable=true) */ protected $firstname; /** * @ORM\Column(type="text") */ protected $address; /** * @ORM\Column(type="string", length=31) */ protected $zip; /** * @ORM\Column(type="string", length=255) */ protected $city; /** * @ORM\Column(type="string", length=255) */ protected $country; /** * @ORM\Column(type="string", length=255, nullable=true) */ protected $company; /** * @ORM\Column(type="string", length=127, nullable=true) */ protected $siret; /** * @ORM\Column(type="string", length=127, nullable=true) */ protected $tva; /** * @ORM\Column(type="array", nullable=true) */ protected $phone; /** * @ORM\Column(type="string", length=32, nullable=true) */ protected $latitude; /** * @ORM\Column(type="string", length=32, nullable=true) */ protected $longitude; /** * @ORM\Column(type="string", length=32, nullable=true) */ protected $latitudeOverride; /** * @ORM\Column(type="string", length=32, nullable=true) */ protected $longitudeOverride; /** * @ORM\Column(type="text", nullable=true) */ protected $comment; /** * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleInterface", mappedBy="address", cascade={"persist"}) */ protected $pointSale; /** * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", mappedBy="address", cascade={"persist"}) */ protected $merchant; /** * @ORM\Column(type="text", nullable=true) */ protected $deliveryInfos; public function __construct() { $this->phone = []; } public function __toString() { return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity(); } public function getUser(): ?UserInterface { return $this->user; } public function setUser(?UserInterface $user): self { $this->user = $user; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } public function getCivility(): ?bool { return $this->civility; } public function setCivility(?bool $civility): self { $this->civility = $civility; return $this; } public function getLastname(): ?string { return $this->lastname; } public function setLastname(?string $lastname): self { $this->lastname = $lastname; return $this; } public function getFirstname(): ?string { return $this->firstname; } public function setFirstname(?string $firstname): self { $this->firstname = $firstname; return $this; } public function getAddress(): ?string { return $this->address; } public function setAddress(string $address): self { $this->address = $address; return $this; } public function getZip(): ?string { return $this->zip; } public function setZip(string $zip): self { $this->zip = $zip; return $this; } public function getCity(): ?string { return $this->city; } public function setCity(string $city): self { $this->city = $city; return $this; } public function getCountry(): ?string { return $this->country; } public function setCountry(string $country): self { $this->country = $country; return $this; } public function getLatitude(): ?string { return $this->latitude; } public function setLatitude(?string $latitude): self { $this->latitude = $latitude; return $this; } public function getLongitude(): ?string { return $this->longitude; } public function setLongitude(?string $longitude): self { $this->longitude = $longitude; return $this; } public function getLatitudeOverride(): ?string { return $this->latitudeOverride; } public function setLatitudeOverride(?string $latitudeOverride): self { $this->latitudeOverride = $latitudeOverride; return $this; } public function getLongitudeOverride(): ?string { return $this->longitudeOverride; } public function setLongitudeOverride(?string $longitudeOverride): self { $this->longitudeOverride = $longitudeOverride; return $this; } public function getCompany(): ?string { return $this->company; } public function setCompany(?string $company): self { $this->company = $company; return $this; } public function getSiret(): ?string { return $this->siret; } public function setSiret(?string $siret): self { $this->siret = $siret; return $this; } public function getTva(): ?string { return $this->tva; } public function setTva(?string $tva): self { $this->tva = $tva; return $this; } public function getPhone(): ?array { return $this->phone; } public function setPhone(?array $phone): self { $this->phone = $phone; return $this; } public function getComment(): ?string { return $this->comment; } public function setComment(?string $comment): self { $this->comment = $comment; return $this; } public function getPointSale(): ?PointSaleInterface { return $this->pointSale; } public function setPointSale(PointSaleInterface $pointSale): self { $this->pointSale = $pointSale; // set the owning side of the relation if necessary if ($pointSale->getAddress() !== $this) { $pointSale->setAddress($this); } return $this; } public function getMerchant(): ?MerchantInterface { return $this->merchant; } public function setMerchant(MerchantInterface $merchant): self { $this->merchant = $merchant; // set the owning side of the relation if necessary if ($merchant->getAddress() !== $this) { $merchant->setAddress($this); } return $this; } public function getDeliveryInfos(): ?string { return $this->deliveryInfos; } public function setDeliveryInfos(?string $deliveryInfos): self { $this->deliveryInfos = $deliveryInfos; return $this; } }