src/Entity/System/CustomerMigration.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * CustomerMigration
  7.  *
  8.  * @ORM\Table(name="ps_customer_migration", uniqueConstraints={
  9.  *
  10.  *        @ORM\UniqueConstraint(name="uk_id_customer_id_customer_old", columns={"id_customer", "id_customer_old"})
  11.  * })
  12.  *
  13.  * @ORM\Entity(repositoryClass="App\Repository\System\CustomerMigrationRepository")
  14.  */
  15. class CustomerMigration
  16. {
  17.     /**
  18.      * @ORM\Id()
  19.      *
  20.      * @ORM\GeneratedValue()
  21.      *
  22.      * @ORM\Column(type="integer", length=11, name="id_customer_migration")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @var Customer
  27.      *
  28.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Customer", inversedBy="customerMigration")
  29.      *
  30.      * @ORM\JoinColumn(name="id_customer", referencedColumnName="id_customer")
  31.      */
  32.     private $customer;
  33.     /**
  34.      * @var Customer
  35.      *
  36.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Customer")
  37.      *
  38.      * @ORM\JoinColumn(name="id_customer_old", referencedColumnName="id_customer")
  39.      */
  40.     private $customerOld;
  41.     /**
  42.      * @var \DateTime
  43.      *
  44.      * @ORM\Column(type="datetime")
  45.      */
  46.     private $dateAdd;
  47.     /**
  48.      * @return mixed
  49.      */
  50.     public function getId()
  51.     {
  52.         return $this->id;
  53.     }
  54.     /**
  55.      * @param mixed $id
  56.      *
  57.      * @return CustomerMigration
  58.      */
  59.     public function setId($id): CustomerMigration
  60.     {
  61.         $this->id $id;
  62.         return $this;
  63.     }
  64.     /**
  65.      * @return Customer
  66.      */
  67.     public function getCustomer(): Customer
  68.     {
  69.         return $this->customer;
  70.     }
  71.     /**
  72.      * @param Customer $customer
  73.      *
  74.      * @return CustomerMigration
  75.      */
  76.     public function setCustomer(Customer $customer): CustomerMigration
  77.     {
  78.         $this->customer $customer;
  79.         return $this;
  80.     }
  81.     /**
  82.      * @return Customer
  83.      */
  84.     public function getCustomerOld(): Customer
  85.     {
  86.         return $this->customerOld;
  87.     }
  88.     /**
  89.      * @param Customer $customerOld
  90.      *
  91.      * @return CustomerMigration
  92.      */
  93.     public function setCustomerOld(Customer $customerOld): CustomerMigration
  94.     {
  95.         $this->customerOld $customerOld;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return \DateTime
  100.      */
  101.     public function getDateAdd(): \DateTime
  102.     {
  103.         return $this->dateAdd;
  104.     }
  105.     /**
  106.      * @param \DateTime $dateAdd
  107.      *
  108.      * @return CustomerMigration
  109.      */
  110.     public function setDateAdd(\DateTime $dateAdd): CustomerMigration
  111.     {
  112.         $this->dateAdd $dateAdd;
  113.         return $this;
  114.     }
  115.     /**
  116.      * @param Customer $newCustomer
  117.      * @param Customer $oldCustomer
  118.      *
  119.      * @return CustomerMigration
  120.      */
  121.     public static function createFromValues(Customer $newCustomerCustomer $oldCustomer): CustomerMigration
  122.     {
  123.         $customerMigration = new self();
  124.         $customerMigration->customer $newCustomer;
  125.         $customerMigration->customerOld $oldCustomer;
  126.         $customerMigration->dateAdd = new \DateTime();
  127.         return $customerMigration;
  128.     }
  129. }