src/Entity/System/CustomerMigration.php line 15

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