|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use FOS\UserBundle\Model\User as UserModelFOS;
- use Lc\ShopBundle\Context\MerchantInterface;
-
- /**
- * @ORM\MappedSuperclass()
- *
- */
- abstract class User extends UserModelFOS
- {
- /**
- * @ORM\Column(type="string", length=20, nullable=true)
- */
- protected $phone;
-
- /**
- * @ORM\Column(type="string", length=64, nullable=true)
- */
- protected $behaviorDisplayPrice;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
- */
- protected $merchant;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\CreditHistoryInterface", mappedBy="user", orphanRemoval=true)
- */
- protected $creditHistories;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\AddressInterface", mappedBy="user", cascade={"persist"})
- */
- protected $addresses;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="user")
- */
- protected $orders;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\CartInterface", mappedBy="user")
- */
- protected $carts;
-
- public function __construct()
- {
- parent::__construct();
- $this->creditHistories = new ArrayCollection();
- $this->addresses = new ArrayCollection();
- $this->orders = new ArrayCollection();
- $this->carts = new ArrayCollection();
- }
-
- public function getPhone(): ?string
- {
- return $this->phone;
- }
-
- public function setPhone(?string $phone): self
- {
- $this->phone = $phone;
-
- return $this;
- }
-
- public function getBehaviorDisplayPrice(): ?string
- {
- return $this->behaviorDisplayPrice;
- }
-
- public function setBehaviorDisplayPrice(?string $behaviorDisplayPrice): self
- {
- $this->behaviorDisplayPrice = $behaviorDisplayPrice;
-
- return $this;
- }
-
- public function getMerchant(): ?MerchantInterface
- {
- return $this->merchant;
- }
-
- public function setMerchant(?MerchantInterface $merchant): self
- {
- $this->merchant = $merchant;
-
- return $this;
- }
-
- /**
- * @return Collection|CreditHistory[]
- */
- public function getCreditHistories(): Collection
- {
- return $this->creditHistories;
- }
-
- public function addCreditHistory(CreditHistory $creditHistory): self
- {
- if (!$this->creditHistories->contains($creditHistory)) {
- $this->creditHistories[] = $creditHistory;
- $creditHistory->setUser($this);
- }
-
- return $this;
- }
-
- public function removeCreditHistory(CreditHistory $creditHistory): self
- {
- if ($this->creditHistories->contains($creditHistory)) {
- $this->creditHistories->removeElement($creditHistory);
- // set the owning side to null (unless already changed)
- if ($creditHistory->getUser() === $this) {
- $creditHistory->setUser(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|Address[]
- */
- public function getAddresses(): Collection
- {
- return $this->addresses;
- }
-
- public function addAddress(Address $address): self
- {
- if (!$this->addresses->contains($address)) {
- $this->addresses[] = $address;
- $address->setUser($this);
- }
-
- return $this;
- }
-
- public function removeAddress(Address $address): self
- {
- if ($this->addresses->contains($address)) {
- $this->addresses->removeElement($address);
- // set the owning side to null (unless already changed)
- if ($address->getUser() === $this) {
- $address->setUser(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|ShopOrder[]
- */
- public function getOrders(): Collection
- {
- return $this->orders;
- }
-
- public function addOrder(OrderShop $order): self
- {
- if (!$this->orders->contains($order)) {
- $this->orders[] = $order;
- $order->setUser($this);
- }
-
- return $this;
- }
-
- public function removeOrder(OrderShop $order): self
- {
- if ($this->orders->contains($order)) {
- $this->orders->removeElement($order);
- // set the owning side to null (unless already changed)
- if ($order->getUser() === $this) {
- $order->setUser(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|Cart[]
- */
- public function getCarts(): Collection
- {
- return $this->carts;
- }
-
- public function addCart(Cart $cart): self
- {
- if (!$this->carts->contains($cart)) {
- $this->carts[] = $cart;
- $cart->setUser($this);
- }
-
- return $this;
- }
-
- public function removeCart(Cart $cart): self
- {
- if ($this->carts->contains($cart)) {
- $this->carts->removeElement($cart);
- // set the owning side to null (unless already changed)
- if ($cart->getUser() === $this) {
- $cart->setUser(null);
- }
- }
-
- return $this;
- }
- }
|