src/Entity/Quotes.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\Criteria;
  7. /**
  8. * Quotes
  9. *
  10. * @ORM\Table(name="quotes")
  11. * @ORM\Entity
  12. */
  13. class Quotes
  14. {
  15. /**
  16. * @var int
  17. *
  18. * @ORM\Column(name="id", type="integer", nullable=false)
  19. * @ORM\Id
  20. * @ORM\GeneratedValue(strategy="IDENTITY")
  21. */
  22. private $id;
  23. /**
  24. * @var int|null
  25. *
  26. * @ORM\Column(name="price_sum", type="integer", nullable=true)
  27. */
  28. private $priceSum;
  29. /**
  30. * @var int|null
  31. *
  32. * @ORM\Column(name="price_sum_br", type="integer", nullable=true)
  33. */
  34. private $priceSumBr;
  35. /**
  36. * @var string|null
  37. *
  38. * @ORM\Column(name="note", type="text", length=65535, nullable=true)
  39. */
  40. private $note;
  41. /**
  42. * @var \DateTime
  43. *
  44. * @ORM\Column(name="created", type="datetime", nullable=false)
  45. */
  46. private $created;
  47. /**
  48. * @var int|null
  49. *
  50. * @ORM\Column(name="price_bodyguard", type="integer", nullable=true)
  51. */
  52. private $priceBodyguard;
  53. /**
  54. * @var int|null
  55. *
  56. * @ORM\Column(name="price_paint", type="integer", nullable=true)
  57. */
  58. private $pricePaint;
  59. /**
  60. * @var int|null
  61. *
  62. * @ORM\Column(name="price_assembly", type="integer", nullable=true)
  63. */
  64. private $priceAssembly;
  65. /**
  66. * @var int
  67. *
  68. * @ORM\Column(name="tax", type="string", nullable=false)
  69. */
  70. private $tax;
  71. /**
  72. * @ORM\OneToMany(targetEntity=QuoteItems::class, mappedBy="quote", cascade={"persist"},orphanRemoval=true)
  73. */
  74. public $quoteItems;
  75. /**
  76. * @ORM\OneToMany(targetEntity=Attachment::class, mappedBy="quote", cascade={"persist"},orphanRemoval=true)
  77. */
  78. public $attachments;
  79. /**
  80. * @var \DateTime
  81. *
  82. * @ORM\Column(name="modified", type="datetime", nullable=true, options={"comment"="Módosítva"})
  83. */
  84. private $modified;
  85. public function __construct()
  86. {
  87. $this->created = new \DateTime();
  88. $this->quoteItems = new ArrayCollection();
  89. $this->attachments = new ArrayCollection();
  90. }
  91. public function getId(): ?int
  92. {
  93. return $this->id;
  94. }
  95. public function getTax(): ?string
  96. {
  97. return $this->tax;
  98. }
  99. public function setTax(?string $tax): self
  100. {
  101. $this->tax = $tax;
  102. return $this;
  103. }
  104. public function getPriceSum(): ?int
  105. {
  106. return $this->priceSum;
  107. }
  108. public function setPriceSum(?int $priceSum): self
  109. {
  110. $this->priceSum = $priceSum;
  111. return $this;
  112. }
  113. public function getPriceSumBr(): ?int
  114. {
  115. return $this->priceSumBr;
  116. }
  117. public function setPriceSumBr(?int $priceSumBr): self
  118. {
  119. $this->priceSumBr = $priceSumBr;
  120. return $this;
  121. }
  122. public function getNote(): ?string
  123. {
  124. return $this->note;
  125. }
  126. public function setNote(?string $note): self
  127. {
  128. $this->note = $note;
  129. return $this;
  130. }
  131. public function getCreated(): ?\DateTimeInterface
  132. {
  133. return $this->created;
  134. }
  135. public function setCreated(\DateTimeInterface $created): self
  136. {
  137. $this->created = $created;
  138. return $this;
  139. }
  140. /**
  141. * @return Collection|QuoteItems[]
  142. */
  143. public function getQuoteItems(): Collection
  144. {
  145. return $this->quoteItems;
  146. }
  147. /* public function addQuoteItem(QuoteItems $quoteItem): self
  148. {
  149. if (!$this->quoteItems->contains($quoteItem)) {
  150. $quoteItem->setQuote($this);
  151. $this->quoteItems[] = $quoteItem;
  152. }
  153. return $this;
  154. }
  155. public function removeQuoteItem(QuoteItems $quoteItem): self
  156. {
  157. if ($this->quoteItems->removeElement($quoteItem)) {
  158. // set the owning side to null (unless already changed)
  159. if ($quoteItem->getQuote() === $this) {
  160. $quoteItem->setQuote(null);
  161. }
  162. }
  163. return $this;
  164. }
  165. */
  166. /**
  167. * @return Collection|QuoteItems[]
  168. */
  169. public function getQuotePaintItems(): Collection
  170. {
  171. $criteria = Criteria::create();
  172. $criteria->where(Criteria::expr()->eq('type', QuoteItems::PAINT));
  173. return $this->quoteItems->matching($criteria);
  174. }
  175. public function addQuotePaintItem(QuoteItems $quoteItem): self
  176. {
  177. if (!$this->quoteItems->contains($quoteItem)) {
  178. $quoteItem->setType(QuoteItems::PAINT);
  179. if($this->getPricePaint() !== null){
  180. $quoteItem->setPriceQty($this->pricePaint);
  181. }
  182. $quoteItem->setQuote($this);
  183. $this->quoteItems[] = $quoteItem;
  184. }
  185. return $this;
  186. }
  187. public function removeQuotePaintItem(QuoteItems $quoteItem): self
  188. {
  189. if ($this->quoteItems->removeElement($quoteItem)) {
  190. // set the owning side to null (unless already changed)
  191. /*if ($quoteItem->getQuote() === $this) {
  192. $quoteItem->setQuote(null);
  193. }*/
  194. }
  195. return $this;
  196. }
  197. /**
  198. * @return Collection|QuoteItems[]
  199. */
  200. public function getQuoteAssemblyItems(): Collection
  201. {
  202. $criteria = Criteria::create();
  203. $criteria->where(Criteria::expr()->eq('type', QuoteItems::ASSEMBLY));
  204. return $this->quoteItems->matching($criteria);
  205. }
  206. public function addQuoteAssemblyItem(QuoteItems $quoteItem): self
  207. {
  208. if (!$this->quoteItems->contains($quoteItem)) {
  209. $quoteItem->setType(QuoteItems::ASSEMBLY);
  210. if($this->getPriceAssembly() !== null){
  211. $quoteItem->setPriceQty($this->priceAssembly);
  212. }
  213. $quoteItem->setQuote($this);
  214. $this->quoteItems[] = $quoteItem;
  215. }
  216. return $this;
  217. }
  218. public function removeQuoteAssemblyItem(QuoteItems $quoteItem): self
  219. {
  220. if ($this->quoteItems->removeElement($quoteItem)) {
  221. // set the owning side to null (unless already changed)
  222. if ($quoteItem->getQuote() === $this) {
  223. $quoteItem->setQuote(null);
  224. }
  225. }
  226. return $this;
  227. }
  228. /**
  229. * @return Collection|QuoteItems[]
  230. */
  231. public function getQuoteBodyguardItems(): Collection
  232. {
  233. $criteria = Criteria::create();
  234. $criteria->where(Criteria::expr()->eq('type', QuoteItems::BODYGUARD));
  235. return $this->quoteItems->matching($criteria);
  236. }
  237. public function addQuoteBodyguardItem(QuoteItems $quoteItem): self
  238. {
  239. if (!$this->quoteItems->contains($quoteItem)) {
  240. $quoteItem->setType(QuoteItems::BODYGUARD);
  241. if($this->getPriceBodyguard() !== null){
  242. $quoteItem->setPriceQty($this->priceBodyguard);
  243. }
  244. $quoteItem->setQuote($this);
  245. $this->quoteItems[] = $quoteItem;
  246. }
  247. return $this;
  248. }
  249. public function removeQuoteBodyguardItem(QuoteItems $quoteItem): self
  250. {
  251. if ($this->quoteItems->removeElement($quoteItem)) {
  252. // set the owning side to null (unless already changed)
  253. if ($quoteItem->getQuote() === $this) {
  254. $quoteItem->setQuote(null);
  255. }
  256. }
  257. return $this;
  258. }
  259. /**
  260. * @return Collection|QuoteItems[]
  261. */
  262. public function getQuoteOtherItems(): Collection
  263. {
  264. $criteria = Criteria::create();
  265. $criteria->where(Criteria::expr()->eq('type', QuoteItems::OTHER));
  266. return $this->quoteItems->matching($criteria);
  267. }
  268. public function addQuoteOtherItem(QuoteItems $quoteItem): self
  269. {
  270. if (!$this->quoteItems->contains($quoteItem)) {
  271. $quoteItem->setType(QuoteItems::OTHER);
  272. $quoteItem->setQuote($this);
  273. $this->quoteItems[] = $quoteItem;
  274. }
  275. return $this;
  276. }
  277. public function removeQuoteOtherItem(QuoteItems $quoteItem): self
  278. {
  279. if ($this->quoteItems->removeElement($quoteItem)) {
  280. // set the owning side to null (unless already changed)
  281. if ($quoteItem->getQuote() === $this) {
  282. $quoteItem->setQuote(null);
  283. }
  284. }
  285. return $this;
  286. }
  287. /**
  288. * @return Collection|Attachment[]
  289. */
  290. public function getAttachments(): Collection
  291. {
  292. return $this->attachments;
  293. }
  294. public function addAttachment(Attachment $photo): self
  295. {
  296. if (!$this->attachments->contains($photo)) {
  297. $photo->setQuote($this);
  298. $this->attachments[] = $photo;
  299. }
  300. return $this;
  301. }
  302. public function removeAttachment(Attachment $photo): self
  303. {
  304. if ($this->attachments->removeElement($photo)) {
  305. // set the owning side to null (unless already changed)
  306. if ($photo->getQuote() === $this) {
  307. $photo->setQuote(null);
  308. }
  309. }
  310. return $this;
  311. }
  312. public function getPriceBodyguard(): ?int
  313. {
  314. return $this->priceBodyguard;
  315. }
  316. public function setPriceBodyguard(?int $priceBodyguard): self
  317. {
  318. $this->priceBodyguard = $priceBodyguard;
  319. return $this;
  320. }
  321. public function getPricePaint(): ?int
  322. {
  323. return $this->pricePaint;
  324. }
  325. public function setPricePaint(?int $pricePaint): self
  326. {
  327. $this->pricePaint = $pricePaint;
  328. return $this;
  329. }
  330. public function getPriceAssembly(): ?int
  331. {
  332. return $this->priceAssembly;
  333. }
  334. public function setPriceAssembly(?int $priceAssembly): self
  335. {
  336. $this->priceAssembly = $priceAssembly;
  337. return $this;
  338. }
  339. public function __toString()
  340. {
  341. return 'Ajánlat - '. $this->getCar()->getPlateNumber() . " - " . $this->getCreated()->format('Ymd');
  342. }
  343. public function rowCss(){
  344. return "";
  345. }
  346. public function getModified(): ?\DateTimeInterface
  347. {
  348. return $this->modified;
  349. }
  350. }