src/Entity/System/SpecificPrice.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * SpecificPrice
  6. *
  7. * @ORM\Table(name="ps_specific_price", indexes={
  8. *
  9. * @ORM\Index(name="from_quantity", columns={"from_quantity"}),
  10. * }, uniqueConstraints={
  11. *
  12. * @ORM\UniqueConstraint(name="uk_specific_price_product_attribute_quantity", columns={"id_product", "id_product_attribute", "from_quantity"}),
  13. * })
  14. *
  15. * @ORM\Entity(repositoryClass="App\Repository\System\SpecificPriceRepository")
  16. */
  17. class SpecificPrice
  18. {
  19. public const DEFAULT_QUANTITY = 1;
  20. /**
  21. * @var int
  22. *
  23. * @ORM\Column(name="id_specific_price", type="integer")
  24. *
  25. * @ORM\Id
  26. *
  27. * @ORM\GeneratedValue(strategy="AUTO")
  28. */
  29. private $id;
  30. /**
  31. * @var Product
  32. *
  33. * @ORM\ManyToOne(targetEntity="Product", inversedBy="specificPrices")
  34. *
  35. * @ORM\JoinColumn(name="id_product", referencedColumnName="id_product", nullable=false)
  36. */
  37. private $product;
  38. /**
  39. * @var ProductAttribute|null
  40. *
  41. * @ORM\ManyToOne(targetEntity="ProductAttribute", inversedBy="specificPrices")
  42. *
  43. * @ORM\JoinColumn(name="id_product_attribute", referencedColumnName="id_product_attribute")
  44. */
  45. private $productAttribute;
  46. /**
  47. * @var float
  48. *
  49. * @ORM\Column(name="reduction", type="float")
  50. */
  51. private $reduction;
  52. /**
  53. * @ORM\Column(name="reduction_old", type="float")
  54. */
  55. private float $reductionOld;
  56. /**
  57. * @var int
  58. *
  59. * @ORM\Column(name="from_quantity", type="integer")
  60. */
  61. private $fromQuantity;
  62. /**
  63. * @deprecated
  64. *
  65. * @var \DateTime|null
  66. *
  67. * @ORM\Column(name="`from`", type="datetime", nullable=true)
  68. */
  69. private $from;
  70. /**
  71. * @deprecated
  72. *
  73. * @var \DateTime|null
  74. *
  75. * @ORM\Column(name="`to`", type="datetime", nullable=true)
  76. */
  77. private $to;
  78. /**
  79. * @deprecated
  80. *
  81. * @var int|null
  82. *
  83. * @ORM\Column(type="integer", nullable=true)
  84. */
  85. private $idShop;
  86. /**
  87. * @deprecated
  88. *
  89. * @var int|null
  90. *
  91. * @ORM\Column(type="integer", nullable=true)
  92. */
  93. private $idCurrency;
  94. /**
  95. * @deprecated
  96. *
  97. * @var int|null
  98. *
  99. * @ORM\Column(type="integer", nullable=true)
  100. */
  101. private $idCountry;
  102. /**
  103. * @deprecated
  104. *
  105. * @var int|null
  106. *
  107. * @ORM\Column(type="integer", nullable=true)
  108. */
  109. private $idGroup;
  110. /**
  111. * @deprecated
  112. *
  113. * @var int|null
  114. *
  115. * @ORM\Column(type="integer", nullable=true)
  116. */
  117. private $idCustomer;
  118. /**
  119. * @deprecated
  120. *
  121. * @var int|null
  122. *
  123. * @ORM\Column(type="integer", nullable=true)
  124. */
  125. private $idShopGroup;
  126. /**
  127. * @deprecated
  128. *
  129. * @var int|null
  130. *
  131. * @ORM\Column(type="integer", nullable=true)
  132. */
  133. private $idCart;
  134. /**
  135. * @deprecated
  136. *
  137. * @var int|null
  138. *
  139. * @ORM\Column(type="integer", nullable=true)
  140. */
  141. private $idSpecificPriceRule;
  142. /**
  143. * @deprecated
  144. *
  145. * @var int|null
  146. *
  147. * @ORM\Column(type="integer", nullable=true)
  148. */
  149. private $price;
  150. /**
  151. * @deprecated
  152. *
  153. * @var float|null
  154. *
  155. * @ORM\Column(type="float", nullable=true)
  156. */
  157. private $reductionWhosalePrice;
  158. /**
  159. * @deprecated
  160. *
  161. * @var string
  162. *
  163. * @ORM\Column(type="string", columnDefinition="enum('amount', 'percentage')", nullable=false)
  164. */
  165. private $reductionType;
  166. public function __construct()
  167. {
  168. $this->reduction = 0.0;
  169. $this->reductionOld = 0.0;
  170. $this->reductionType = 'amount';
  171. }
  172. /**
  173. * @return int
  174. */
  175. public function getId(): int
  176. {
  177. return $this->id;
  178. }
  179. public function getProduct(): Product
  180. {
  181. return $this->product;
  182. }
  183. /**
  184. * @param Product $product
  185. *
  186. * @return SpecificPrice
  187. */
  188. public function setProduct(Product $product): SpecificPrice
  189. {
  190. $this->product = $product;
  191. return $this;
  192. }
  193. /**
  194. * @return ProductAttribute
  195. */
  196. public function getProductAttribute(): ProductAttribute
  197. {
  198. return $this->productAttribute;
  199. }
  200. /**
  201. * @param ProductAttribute $productAttribute
  202. *
  203. * @return SpecificPrice
  204. */
  205. public function setProductAttribute(ProductAttribute $productAttribute): SpecificPrice
  206. {
  207. $this->productAttribute = $productAttribute;
  208. return $this;
  209. }
  210. /**
  211. * @return float
  212. */
  213. public function getReduction(): float
  214. {
  215. return $this->reduction;
  216. }
  217. /**
  218. * @param float $reduction
  219. *
  220. * @return SpecificPrice
  221. */
  222. public function setReduction(float $reduction): SpecificPrice
  223. {
  224. $this->reduction = $reduction;
  225. return $this;
  226. }
  227. /**
  228. * @return float
  229. */
  230. public function getReductionOld(): float
  231. {
  232. return $this->reductionOld;
  233. }
  234. /**
  235. * @param float $reductionOld
  236. *
  237. * @return SpecificPrice
  238. */
  239. public function setReductionOld(float $reductionOld): SpecificPrice
  240. {
  241. $this->reductionOld = $reductionOld;
  242. return $this;
  243. }
  244. /**
  245. * @return int
  246. */
  247. public function getFromQuantity(): int
  248. {
  249. return $this->fromQuantity;
  250. }
  251. /**
  252. * @param int $fromQuantity
  253. *
  254. * @return SpecificPrice
  255. */
  256. public function setFromQuantity(int $fromQuantity): SpecificPrice
  257. {
  258. $this->fromQuantity = $fromQuantity;
  259. return $this;
  260. }
  261. public function getFrom(): \DateTime
  262. {
  263. return $this->from;
  264. }
  265. public function setFrom(\DateTime $from): SpecificPrice
  266. {
  267. $this->from = $from;
  268. return $this;
  269. }
  270. public function getTo(): \DateTime
  271. {
  272. return $this->to;
  273. }
  274. public function setTo(\DateTime $to): SpecificPrice
  275. {
  276. $this->to = $to;
  277. return $this;
  278. }
  279. public function getIdShop(): int
  280. {
  281. return $this->idShop;
  282. }
  283. public function setIdShop(int $idShop): SpecificPrice
  284. {
  285. $this->idShop = $idShop;
  286. return $this;
  287. }
  288. public function getIdCurrency(): int
  289. {
  290. return $this->idCurrency;
  291. }
  292. public function setIdCurrency(int $idCurrency): SpecificPrice
  293. {
  294. $this->idCurrency = $idCurrency;
  295. return $this;
  296. }
  297. public function getIdCountry(): int
  298. {
  299. return $this->idCountry;
  300. }
  301. public function setIdCountry(int $idCountry): SpecificPrice
  302. {
  303. $this->idCountry = $idCountry;
  304. return $this;
  305. }
  306. public function getIdGroup(): int
  307. {
  308. return $this->idGroup;
  309. }
  310. public function setIdGroup(int $idGroup): SpecificPrice
  311. {
  312. $this->idGroup = $idGroup;
  313. return $this;
  314. }
  315. public function getIdCustomer(): int
  316. {
  317. return $this->idCustomer;
  318. }
  319. public function setIdCustomer(int $idCustomer): SpecificPrice
  320. {
  321. $this->idCustomer = $idCustomer;
  322. return $this;
  323. }
  324. public function getIdShopGroup(): int
  325. {
  326. return $this->idShopGroup;
  327. }
  328. public function setIdShopGroup(int $idShopGroup): SpecificPrice
  329. {
  330. $this->idShopGroup = $idShopGroup;
  331. return $this;
  332. }
  333. public function getIdCart(): int
  334. {
  335. return $this->idCart;
  336. }
  337. public function setIdCart(int $idCart): SpecificPrice
  338. {
  339. $this->idCart = $idCart;
  340. return $this;
  341. }
  342. public function getIdSpecificPriceRule(): int
  343. {
  344. return $this->idSpecificPriceRule;
  345. }
  346. public function setIdSpecificPriceRule(int $idSpecificPriceRule): SpecificPrice
  347. {
  348. $this->idSpecificPriceRule = $idSpecificPriceRule;
  349. return $this;
  350. }
  351. public function getPrice(): int
  352. {
  353. return $this->price;
  354. }
  355. public function setPrice(int $price): SpecificPrice
  356. {
  357. $this->price = $price;
  358. return $this;
  359. }
  360. public function getReductionWhosalePrice(): float
  361. {
  362. return $this->reductionWhosalePrice;
  363. }
  364. public function setReductionWhosalePrice(float $reductionWhosalePrice): SpecificPrice
  365. {
  366. $this->reductionWhosalePrice = $reductionWhosalePrice;
  367. return $this;
  368. }
  369. public function getReductionType(): string
  370. {
  371. return $this->reductionType;
  372. }
  373. public function setReductionType(string $reductionType): SpecificPrice
  374. {
  375. $this->reductionType = $reductionType;
  376. return $this;
  377. }
  378. }