src/ShippingBundle/Entity/ShippingAddress.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\ShippingBundle\Entity;
  3. use App\ShippingBundle\Model\ShippingAddressModel;
  4. use App\UserBundle\Entity\User;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use PN\ServiceBundle\Interfaces\DateTimeInterface;
  7. use PN\ServiceBundle\Model\DateTimeTrait;
  8. use PN\ServiceBundle\Model\VirtualDeleteTrait;
  9. /**
  10. * ShippingAddress
  11. * @ORM\HasLifecycleCallbacks
  12. * @ORM\Table("shipping_address")
  13. * @ORM\Entity(repositoryClass="App\ShippingBundle\Repository\ShippingAddressRepository")
  14. */
  15. class ShippingAddress extends ShippingAddressModel implements DateTimeInterface
  16. {
  17. use VirtualDeleteTrait;
  18. use DateTimeTrait;
  19. /**
  20. * @ORM\Column(name="id", type="integer")
  21. * @ORM\Id
  22. * @ORM\GeneratedValue(strategy="AUTO")
  23. */
  24. private ?int $id = null;
  25. /**
  26. * @ORM\ManyToOne(targetEntity="App\UserBundle\Entity\User")
  27. */
  28. private ?User $user = null;
  29. /**
  30. * @ORM\Column(name="`default`", type="boolean")
  31. */
  32. private bool $default = false;
  33. public function getObj(): array
  34. {
  35. return [
  36. "id" => $this->getId(),
  37. "title" => $this->getTitle(),
  38. "mobileNumber" => $this->getMobileNumber(),
  39. "address" => $this->getFullAddress(),
  40. "zone" => $this->getZone()->getObj(),
  41. "default" => $this->getDefault(),
  42. ];
  43. }
  44. public function getId(): ?int
  45. {
  46. return $this->id;
  47. }
  48. public function getUser(): ?User
  49. {
  50. return $this->user;
  51. }
  52. public function setUser(?User $user): self
  53. {
  54. $this->user = $user;
  55. return $this;
  56. }
  57. public function getDefault(): ?bool
  58. {
  59. return $this->default;
  60. }
  61. public function setDefault(bool $default): self
  62. {
  63. $this->default = $default;
  64. return $this;
  65. }
  66. }