Cart.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * @ORM\MappedSuperclass()
  6. */
  7. abstract class Cart extends AbstractEntity
  8. {
  9. /**
  10. * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\VisitorInterface", inversedBy="cart", cascade={"persist", "remove"})
  11. * @ORM\JoinColumn(nullable=false)
  12. */
  13. protected $visitor;
  14. /**
  15. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="carts")
  16. */
  17. protected $user;
  18. /**
  19. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface")
  20. */
  21. protected $address;
  22. public function getVisitor(): ?Visitor
  23. {
  24. return $this->visitor;
  25. }
  26. public function setVisitor(Visitor $visitor): self
  27. {
  28. $this->visitor = $visitor;
  29. return $this;
  30. }
  31. public function getUser(): ?User
  32. {
  33. return $this->user;
  34. }
  35. public function setUser(?User $user): self
  36. {
  37. $this->user = $user;
  38. return $this;
  39. }
  40. public function getAddress(): ?Address
  41. {
  42. return $this->address;
  43. }
  44. public function setAddress(?Address $address): self
  45. {
  46. $this->address = $address;
  47. return $this;
  48. }
  49. }