|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\ORM\Mapping as ORM;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class Address extends AbstractEntity
- {
- /**
- * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="addresses")
- * @ORM\JoinColumn(nullable=true)
- */
- 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="string", length=127, nullable=true)
- */
- protected $phone;
-
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- protected $comment;
-
- /**
- * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"})
- */
- protected $pointSale;
-
- /**
- * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", mappedBy="address", cascade={"persist", "remove"})
- */
- protected $merchant;
-
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- protected $deliveryInfos;
-
-
- public function __toString()
- {
- return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity();
- }
-
- public function getSummaryShort()
- {
- return $this->getAddress() . ' - ' . $this->getZip() . ' ' . $this->getCity();
- }
-
- public function getSummary()
- {
- $html = '';
-
- if ($this->getTitle()) {
- $html .= $this->getTitle() . '<br />';
- }
-
- if ($this->getLastname() || $this->getFirstname()) {
- $html .= $this->getLastname() . ' ' . $this->getFirstname() . '<br />';
- }
-
- if ($this->getAddress()) {
- $html .= $this->getAddress() . '<br />';
- }
-
- if ($this->getZip() || $this->getCity()) {
- $html .= $this->getZip() . ' ' . $this->getCity() . '<br />';
- }
-
- if ($this->getPhone()) {
- $html .= 'Tél. ' . $this->getPhone();
- }
-
- return $html;
- }
-
- public function getUser(): ?User
- {
- return $this->user;
- }
-
- public function setUser(?User $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 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(): ?string
- {
- return $this->phone;
- }
-
- public function setPhone(?string $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(): ?PointSale
- {
- return $this->pointSale;
- }
-
- public function setPointSale(PointSale $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(): ?Merchant
- {
- return $this->merchant;
- }
-
- public function setMerchant(Merchant $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;
- }
- }
|