src/Diplix/KMGBundle/Entity/Address.php line 11

Open in your IDE?
  1. <?php
  2. namespace Diplix\KMGBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Imagine\Exception\NotSupportedException;
  5. use Symfony\Component\PropertyAccess\PropertyAccess;
  6. /**
  7.  * @ORM\Table(name="addresses", indexes={@ORM\Index(name="be_deleted",columns={"be_deleted"})})
  8.  * @ORM\Entity(repositoryClass="Diplix\KMGBundle\Repository\AddressRepository", )
  9.  */
  10. class Address extends BasicEntity implements \JsonSerializable
  11. {
  12.     const WAYPOINT_IN "Einstieg";
  13.     const WAYPOINT_OUT "Ausstieg";
  14.     /**
  15.      * @ORM\Column(type="integer",name="id")
  16.      * @ORM\Id()
  17.      * @ORM\GeneratedValue(strategy="AUTO")
  18.      */
  19.     protected $id;
  20.     /**
  21.      * @ORM\ManyToOne(targetEntity="Order", inversedBy="addressList")
  22.      * @ORM\JoinColumn(referencedColumnName="id")
  23.      */
  24.     protected $owningOrder;
  25.     /**
  26.      * @ORM\Column(type="string")
  27.      */
  28.     protected $waypointType self::WAYPOINT_IN;
  29.     /**
  30.      * @ORM\Column(type="string")
  31.      */
  32.     protected $name;
  33.     /**
  34.      * @ORM\Column(type="string")
  35.      */
  36.     protected $passenger="";
  37.     /**
  38.      * @ORM\Column(type="string")
  39.      */
  40.     protected $street;
  41.     /**
  42.      * @ORM\Column(type="string")
  43.      */
  44.     protected $number;
  45.     /**
  46.      * @ORM\Column(type="string")
  47.      */
  48.     protected $zipCode;
  49.     /**
  50.      * @ORM\Column(type="string")
  51.      */
  52.     protected $city;
  53.     /**
  54.      * @ORM\Column(type="string")
  55.      */
  56.     protected $mobileNumber "";
  57.     /**
  58.      * @ORM\Column(type="string")
  59.      */
  60.     protected $creditCardNo "";
  61.     /**
  62.      * @ORM\Column(type="string")
  63.      */
  64.     protected $creditCardMonth "";
  65.     /**
  66.      * @ORM\Column(type="string")
  67.      */
  68.     protected $creditCardYear "";
  69.      /**
  70.       * A address may be assigned to a customer, but it doesn't have to
  71.      * @ORM\ManyToOne(targetEntity="Customer")
  72.      * @ORM\JoinColumn(name="customer_id",nullable=true)
  73.      */
  74.     protected $customer;
  75.     /**
  76.      * @ORM\Column(type="integer")
  77.      */
  78.     protected $sortOrder 0;
  79.     /**
  80.      * @ORM\ManyToOne(targetEntity="Diplix\KMGBundle\Entity\AddressType")
  81.      * @ORM\JoinColumn(referencedColumnName="id")
  82.      */
  83.     protected $addressType;
  84.     /**
  85.      * @ORM\Column(type="string")
  86.      */
  87.     protected $email "";
  88.     /**
  89.      * @ORM\Column(type="boolean", options={"default"="0"})
  90.      */
  91.     protected $sendQuittung false;
  92.     /**
  93.      * @ORM\Column(type="boolean", options={"default"="0"})
  94.      */
  95.     protected $fixedBySystem false;
  96.     public function __construct($customer=null$sortOrder=0)
  97.     {
  98.         $this->setCustomer($customer);
  99.         $this->setSortOrder($sortOrder);
  100.     }
  101.     public function __clone()
  102.     {
  103.         $this->owningOrder null;
  104.         $this->id null;
  105.     }
  106.     /**
  107.      * @return mixed
  108.      */
  109.     public function getId()
  110.     {
  111.         return $this->id;
  112.     }
  113.     /**
  114.      * @return mixed
  115.      */
  116.     public function getOwningOrder()
  117.     {
  118.         return $this->owningOrder;
  119.     }
  120.     /**
  121.      * @param mixed $owningOrder
  122.      */
  123.     public function setOwningOrder($owningOrder)
  124.     {
  125.         $this->owningOrder $owningOrder;
  126.     }
  127.     /**
  128.      * @return mixed
  129.      */
  130.     public function getWaypointType()
  131.     {
  132.         return $this->waypointType;
  133.     }
  134.     /**
  135.      * @param mixed $waypointType
  136.      */
  137.     public function setWaypointType($waypointType)
  138.     {
  139.         $this->waypointType $waypointType;
  140.     }
  141.     /**
  142.      * @return mixed
  143.      */
  144.     public function getName()
  145.     {
  146.         return $this->name;
  147.     }
  148.     /**
  149.      * @param mixed $name
  150.      */
  151.     public function setName($name)
  152.     {
  153.         $this->name $name;
  154.     }
  155.     /**
  156.      * @return mixed
  157.      */
  158.     public function getStreet()
  159.     {
  160.         return $this->street;
  161.     }
  162.     /**
  163.      * @param mixed $street
  164.      */
  165.     public function setStreet($street)
  166.     {
  167.         $this->street $street;
  168.     }
  169.     /**
  170.      * @return mixed
  171.      */
  172.     public function getNumber()
  173.     {
  174.         return $this->number;
  175.     }
  176.     /**
  177.      * @param mixed $number
  178.      */
  179.     public function setNumber($number)
  180.     {
  181.         $this->number $number;
  182.     }
  183.     /**
  184.      * @return mixed
  185.      */
  186.     public function getZipCode()
  187.     {
  188.         return $this->zipCode;
  189.     }
  190.     /**
  191.      * @param mixed $zipCode
  192.      */
  193.     public function setZipCode($zipCode)
  194.     {
  195.         $this->zipCode $zipCode;
  196.     }
  197.     /**
  198.      * @return mixed
  199.      */
  200.     public function getCity()
  201.     {
  202.         return $this->city;
  203.     }
  204.     /**
  205.      * @param mixed $city
  206.      */
  207.     public function setCity($city)
  208.     {
  209.         $this->city $city;
  210.     }
  211.     /**
  212.      * @return mixed
  213.      */
  214.     public function getCustomer()
  215.     {
  216.         return $this->customer;
  217.     }
  218.     /**
  219.      * @param mixed $customer
  220.      */
  221.     public function setCustomer($customer)
  222.     {
  223.         $this->customer $customer;
  224.     }
  225.     /**
  226.      * @return mixed
  227.      */
  228.     public function getSortOrder()
  229.     {
  230.         return $this->sortOrder;
  231.     }
  232.     /**
  233.      * @param mixed $sortOrder
  234.      */
  235.     public function setSortOrder($sortOrder)
  236.     {
  237.         $this->sortOrder $sortOrder;
  238.     }
  239.     /**
  240.      * @return mixed
  241.      */
  242.     public function getPassenger()
  243.     {
  244.         return $this->passenger;
  245.     }
  246.     /**
  247.      * @param mixed $passenger
  248.      */
  249.     public function setPassenger($passenger)
  250.     {
  251.         $this->passenger $passenger;
  252.     }
  253.     /**
  254.      * @return AddressType
  255.      */
  256.     public function getAddressType()
  257.     {
  258.         return $this->addressType;
  259.     }
  260.     /**
  261.      * @param AddressType $addressType
  262.      */
  263.     public function setAddressType($addressType)
  264.     {
  265.         $this->addressType $addressType;
  266.     }
  267.     /**
  268.      * @return mixed
  269.      */
  270.     public function getMobileNumber()
  271.     {
  272.         return $this->mobileNumber;
  273.     }
  274.     /**
  275.      * @param mixed $mobileNumber
  276.      */
  277.     public function setMobileNumber($mobileNumber)
  278.     {
  279.         $this->mobileNumber $mobileNumber;
  280.     }
  281.     /**
  282.      * @return mixed
  283.      */
  284.     public function getCreditCardNo()
  285.     {
  286.         return $this->creditCardNo;
  287.     }
  288.     /**
  289.      * @param mixed $creditCardNo
  290.      */
  291.     public function setCreditCardNo($creditCardNo)
  292.     {
  293.         $this->creditCardNo $creditCardNo;
  294.     }
  295.     /**
  296.      * @return mixed
  297.      */
  298.     public function getCreditCardMonth()
  299.     {
  300.         return $this->creditCardMonth;
  301.     }
  302.     /**
  303.      * @param mixed $creditCardMonth
  304.      */
  305.     public function setCreditCardMonth($creditCardMonth)
  306.     {
  307.         $this->creditCardMonth $creditCardMonth;
  308.     }
  309.     /**
  310.      * @return mixed
  311.      */
  312.     public function getCreditCardYear()
  313.     {
  314.         return $this->creditCardYear;
  315.     }
  316.     /**
  317.      * @param mixed $creditCardYear
  318.      */
  319.     public function setCreditCardYear($creditCardYear)
  320.     {
  321.         $this->creditCardYear $creditCardYear;
  322.     }
  323.     /**
  324.      * @return mixed
  325.      */
  326.     public function getEmail()
  327.     {
  328.         return $this->email;
  329.     }
  330.     /**
  331.      * @param mixed $email
  332.      */
  333.     public function setEmail($email)
  334.     {
  335.         $this->email $email;
  336.     }
  337.     /**
  338.      * @return boolean
  339.      */
  340.     public function getFixedBySystem()
  341.     {
  342.         return $this->fixedBySystem;
  343.     }
  344.     /**
  345.      * @param boolean $fixedBySystem
  346.      */
  347.     public function setFixedBySystem($fixedBySystem)
  348.     {
  349.         $this->fixedBySystem $fixedBySystem;
  350.     }
  351.     /**
  352.      * Specify data which should be serialized to JSON
  353.      * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
  354.      * @return mixed data which can be serialized by <b>json_encode</b>,
  355.      * which is a value of any type other than a resource.
  356.      * @since 5.4.0
  357.      */
  358.     function jsonSerialize($prefix "")
  359.     {
  360.         return [
  361.             $prefix."email" => $this->getEmail(),
  362.             $prefix."street" => $this->getStreet(),
  363.             $prefix."number" => $this->getNumber(),
  364.             $prefix."city"=> $this->getCity(),
  365.             $prefix."zipCode" => $this->getZipCode(),
  366.             $prefix."name"=>$this->getName(),
  367.             $prefix."passenger"=>$this->getPassenger(),
  368.             $prefix."sortOrder"=>$this->getSortOrder(),
  369.             $prefix."mobileNumber"=>$this->getMobileNumber(),
  370.         ];
  371.     }
  372.     function fromJson(array $data)
  373.     {
  374.         $pp PropertyAccess::createPropertyAccessor();
  375.         foreach(["email","street","number","city","zipCode","name","passenger","sortOrder","mobileNumber"] as $k)
  376.         {
  377.             if (isset($data[$k]))
  378.             {
  379.                 $pp->setValue($this,$k,$data[$k]);
  380.             }
  381.         }
  382.     }
  383.     public function isSendQuittung(): bool
  384.     {
  385.         return $this->sendQuittung;
  386.     }
  387.     public function setSendQuittung(bool $sendQuittung): void
  388.     {
  389.         $this->sendQuittung $sendQuittung;
  390.     }
  391. }