src/Entity/Quotes.php line 13

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\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\Common\Collections\Criteria;
  8. #[ORM\Table(name: 'quotes')]
  9. #[ORM\Entity]
  10. class Quotes
  11. {
  12. #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
  13. #[ORM\Id]
  14. #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  15. private $id;
  16. #[ORM\Column(name: 'price_sum', type: 'integer', nullable: true)]
  17. private $priceSum;
  18. #[ORM\Column(name: 'price_sum_br', type: 'integer', nullable: true)]
  19. private $priceSumBr;
  20. #[ORM\Column(name: 'note', type: 'text', length: 65535, nullable: true)]
  21. private $note;
  22. #[ORM\Column(name: 'created', type: 'datetime', nullable: false)]
  23. private $created;
  24. #[ORM\Column(name: 'price_bodyguard', type: 'integer', nullable: true)]
  25. private $priceBodyguard;
  26. #[ORM\Column(name: 'price_paint', type: 'integer', nullable: true)]
  27. private $pricePaint;
  28. #[ORM\Column(name: 'price_assembly', type: 'integer', nullable: true)]
  29. private $priceAssembly;
  30. #[ORM\Column(name: 'tax', type: 'string', nullable: true)]
  31. private $tax;
  32. #[ORM\OneToMany(targetEntity: QuoteItems::class, mappedBy: 'quote', cascade: ['persist'], orphanRemoval: true)]
  33. public $quoteItems;
  34. #[ORM\OneToMany(targetEntity: Attachment::class, mappedBy: 'quote', cascade: ['persist'], orphanRemoval: true)]
  35. public $attachments;
  36. #[ORM\Column(name: 'modified', type: 'datetime', nullable: true, options: ['comment' => 'Módosítva'])]
  37. private $modified;
  38. #[ORM\Column(length: 255, nullable: true)]
  39. private ?string $CustomerName = null;
  40. #[ORM\Column(length: 255, nullable: true)]
  41. private ?string $CustomerMail = null;
  42. #[ORM\Column(length: 255, nullable: true)]
  43. private ?string $CustomerPhone = null;
  44. #[ORM\Column(length: 255, nullable: true)]
  45. private ?string $CustomerAddress = null;
  46. #[ORM\Column(length: 255, nullable: true)]
  47. private ?string $Title = null;
  48. #[ORM\Column(type: Types::TEXT, nullable: true)]
  49. private ?string $OriginalText = null;
  50. #[ORM\Column(type: Types::TEXT, nullable: true)]
  51. private ?string $ShortDesc = null;
  52. #[ORM\Column]
  53. private ?int $status = null;
  54. public static $statuses = [
  55. 0 => 'Új',
  56. 1 => 'Kiküldve',
  57. 2 => 'Elfogadva',
  58. 3 => 'Pontosításra vár',
  59. 4 => 'Elutasítva',
  60. ];
  61. #[ORM\Column(type: Types::TEXT, nullable: true)]
  62. private ?string $sentMail = null;
  63. #[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'quotes')]
  64. private ?self $parent = null;
  65. #[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
  66. private Collection $quotes;
  67. public function __construct()
  68. {
  69. $this->created = new \DateTime();
  70. $this->quoteItems = new ArrayCollection();
  71. $this->attachments = new ArrayCollection();
  72. $this->status = 0;
  73. $this->quotes = new ArrayCollection();
  74. }
  75. public function getId(): ?int
  76. {
  77. return $this->id;
  78. }
  79. public function getTax(): ?string
  80. {
  81. return $this->tax;
  82. }
  83. public function setTax(?string $tax): self
  84. {
  85. $this->tax = $tax;
  86. return $this;
  87. }
  88. public function getPriceSum(): ?int
  89. {
  90. return $this->priceSum;
  91. }
  92. public function setPriceSum(?int $priceSum): self
  93. {
  94. $this->priceSum = $priceSum;
  95. return $this;
  96. }
  97. public function getPriceSumBr(): ?int
  98. {
  99. return $this->priceSumBr;
  100. }
  101. public function setPriceSumBr(?int $priceSumBr): self
  102. {
  103. $this->priceSumBr = $priceSumBr;
  104. return $this;
  105. }
  106. public function getNote(): ?string
  107. {
  108. return $this->note;
  109. }
  110. public function setNote(?string $note): self
  111. {
  112. $this->note = $note;
  113. return $this;
  114. }
  115. public function getCreated(): ?\DateTimeInterface
  116. {
  117. return $this->created;
  118. }
  119. public function setCreated(\DateTimeInterface $created): self
  120. {
  121. $this->created = $created;
  122. return $this;
  123. }
  124. /**
  125. * @return Collection|QuoteItems[]
  126. */
  127. public function getQuoteItems(): Collection
  128. {
  129. return $this->quoteItems;
  130. }
  131. /* public function addQuoteItem(QuoteItems $quoteItem): self
  132. {
  133. if (!$this->quoteItems->contains($quoteItem)) {
  134. $quoteItem->setQuote($this);
  135. $this->quoteItems[] = $quoteItem;
  136. }
  137. return $this;
  138. }
  139. public function removeQuoteItem(QuoteItems $quoteItem): self
  140. {
  141. if ($this->quoteItems->removeElement($quoteItem)) {
  142. // set the owning side to null (unless already changed)
  143. if ($quoteItem->getQuote() === $this) {
  144. $quoteItem->setQuote(null);
  145. }
  146. }
  147. return $this;
  148. }
  149. */
  150. /**
  151. * @return Collection|QuoteItems[]
  152. */
  153. public function getQuotePaintItems(): Collection
  154. {
  155. $criteria = Criteria::create();
  156. $criteria->where(Criteria::expr()->eq('type', QuoteItems::PAINT));
  157. return $this->quoteItems->matching($criteria);
  158. }
  159. public function addQuotePaintItem(QuoteItems $quoteItem): self
  160. {
  161. if (!$this->quoteItems->contains($quoteItem)) {
  162. $quoteItem->setType(QuoteItems::PAINT);
  163. if($this->getPricePaint() !== null){
  164. $quoteItem->setPriceQty($this->pricePaint);
  165. }
  166. $quoteItem->setQuote($this);
  167. $this->quoteItems[] = $quoteItem;
  168. }
  169. return $this;
  170. }
  171. public function removeQuotePaintItem(QuoteItems $quoteItem): self
  172. {
  173. if ($this->quoteItems->removeElement($quoteItem)) {
  174. // set the owning side to null (unless already changed)
  175. /*if ($quoteItem->getQuote() === $this) {
  176. $quoteItem->setQuote(null);
  177. }*/
  178. }
  179. return $this;
  180. }
  181. /**
  182. * @return Collection|QuoteItems[]
  183. */
  184. public function getQuoteAssemblyItems(): Collection
  185. {
  186. $criteria = Criteria::create();
  187. $criteria->where(Criteria::expr()->eq('type', QuoteItems::ASSEMBLY));
  188. return $this->quoteItems->matching($criteria);
  189. }
  190. public function addQuoteAssemblyItem(QuoteItems $quoteItem): self
  191. {
  192. if (!$this->quoteItems->contains($quoteItem)) {
  193. $quoteItem->setType(QuoteItems::ASSEMBLY);
  194. if($this->getPriceAssembly() !== null){
  195. $quoteItem->setPriceQty($this->priceAssembly);
  196. }
  197. $quoteItem->setQuote($this);
  198. $this->quoteItems[] = $quoteItem;
  199. }
  200. return $this;
  201. }
  202. public function removeQuoteAssemblyItem(QuoteItems $quoteItem): self
  203. {
  204. if ($this->quoteItems->removeElement($quoteItem)) {
  205. // set the owning side to null (unless already changed)
  206. if ($quoteItem->getQuote() === $this) {
  207. $quoteItem->setQuote(null);
  208. }
  209. }
  210. return $this;
  211. }
  212. /**
  213. * @return Collection|QuoteItems[]
  214. */
  215. public function getQuoteBodyguardItems(): Collection
  216. {
  217. $criteria = Criteria::create();
  218. $criteria->where(Criteria::expr()->eq('type', QuoteItems::BODYGUARD));
  219. return $this->quoteItems->matching($criteria);
  220. }
  221. public function addQuoteBodyguardItem(QuoteItems $quoteItem): self
  222. {
  223. if (!$this->quoteItems->contains($quoteItem)) {
  224. $quoteItem->setType(QuoteItems::BODYGUARD);
  225. if($this->getPriceBodyguard() !== null){
  226. $quoteItem->setPriceQty($this->priceBodyguard);
  227. }
  228. $quoteItem->setQuote($this);
  229. $this->quoteItems[] = $quoteItem;
  230. }
  231. return $this;
  232. }
  233. public function removeQuoteBodyguardItem(QuoteItems $quoteItem): self
  234. {
  235. if ($this->quoteItems->removeElement($quoteItem)) {
  236. // set the owning side to null (unless already changed)
  237. if ($quoteItem->getQuote() === $this) {
  238. $quoteItem->setQuote(null);
  239. }
  240. }
  241. return $this;
  242. }
  243. /**
  244. * @return Collection|QuoteItems[]
  245. */
  246. public function getQuoteOtherItems(): Collection
  247. {
  248. $criteria = Criteria::create();
  249. $criteria->where(Criteria::expr()->eq('type', QuoteItems::OTHER));
  250. return $this->quoteItems->matching($criteria);
  251. }
  252. public function addQuoteOtherItem(QuoteItems $quoteItem): self
  253. {
  254. if (!$this->quoteItems->contains($quoteItem)) {
  255. $quoteItem->setType(QuoteItems::OTHER);
  256. $quoteItem->setQuote($this);
  257. $this->quoteItems[] = $quoteItem;
  258. }
  259. return $this;
  260. }
  261. public function removeQuoteOtherItem(QuoteItems $quoteItem): self
  262. {
  263. if ($this->quoteItems->removeElement($quoteItem)) {
  264. // set the owning side to null (unless already changed)
  265. if ($quoteItem->getQuote() === $this) {
  266. $quoteItem->setQuote(null);
  267. }
  268. }
  269. return $this;
  270. }
  271. /**
  272. * @return Collection|Attachment[]
  273. */
  274. public function getAttachments(): Collection
  275. {
  276. return $this->attachments;
  277. }
  278. public function addAttachment(Attachment $photo): self
  279. {
  280. if (!$this->attachments->contains($photo)) {
  281. $photo->setQuote($this);
  282. $this->attachments[] = $photo;
  283. }
  284. return $this;
  285. }
  286. public function removeAttachment(Attachment $photo): self
  287. {
  288. if ($this->attachments->removeElement($photo)) {
  289. // set the owning side to null (unless already changed)
  290. if ($photo->getQuote() === $this) {
  291. $photo->setQuote(null);
  292. }
  293. }
  294. return $this;
  295. }
  296. public function getPriceBodyguard(): ?int
  297. {
  298. return $this->priceBodyguard;
  299. }
  300. public function setPriceBodyguard(?int $priceBodyguard): self
  301. {
  302. $this->priceBodyguard = $priceBodyguard;
  303. return $this;
  304. }
  305. public function getPricePaint(): ?int
  306. {
  307. return $this->pricePaint;
  308. }
  309. public function setPricePaint(?int $pricePaint): self
  310. {
  311. $this->pricePaint = $pricePaint;
  312. return $this;
  313. }
  314. public function getPriceAssembly(): ?int
  315. {
  316. return $this->priceAssembly;
  317. }
  318. public function setPriceAssembly(?int $priceAssembly): self
  319. {
  320. $this->priceAssembly = $priceAssembly;
  321. return $this;
  322. }
  323. public function __toString()
  324. {
  325. return 'Ajánlat - '. $this->getCustomerName() . " - " . $this->getTitle();
  326. }
  327. public function rowCss(){
  328. return "";
  329. }
  330. public function getModified(): ?\DateTimeInterface
  331. {
  332. return $this->modified;
  333. }
  334. public function getCustomerName(): ?string
  335. {
  336. return $this->CustomerName;
  337. }
  338. public function setCustomerName(?string $CustomerName): static
  339. {
  340. $this->CustomerName = $CustomerName;
  341. return $this;
  342. }
  343. public function getCustomerMail(): ?string
  344. {
  345. return $this->CustomerMail;
  346. }
  347. public function setCustomerMail(string $CustomerMail): static
  348. {
  349. $this->CustomerMail = $CustomerMail;
  350. return $this;
  351. }
  352. public function getCustomerPhone(): ?string
  353. {
  354. return $this->CustomerPhone;
  355. }
  356. public function setCustomerPhone(?string $CustomerPhone): static
  357. {
  358. $this->CustomerPhone = $CustomerPhone;
  359. return $this;
  360. }
  361. public function getCustomerAddress(): ?string
  362. {
  363. return $this->CustomerAddress;
  364. }
  365. public function setCustomerAddress(?string $CustomerAddress): static
  366. {
  367. $this->CustomerAddress = $CustomerAddress;
  368. return $this;
  369. }
  370. public function getTitle(): ?string
  371. {
  372. return $this->Title;
  373. }
  374. public function setTitle(string $Title): static
  375. {
  376. $this->Title = $Title;
  377. return $this;
  378. }
  379. public function getOriginalText(): ?string
  380. {
  381. return $this->OriginalText;
  382. }
  383. public function setOriginalText(?string $OriginalText): static
  384. {
  385. $this->OriginalText = $OriginalText;
  386. return $this;
  387. }
  388. public function getShortDesc(): ?string
  389. {
  390. return $this->ShortDesc;
  391. }
  392. public function setShortDesc(?string $ShortDesc): static
  393. {
  394. $this->ShortDesc = $ShortDesc;
  395. return $this;
  396. }
  397. public function getStatus(): ?int
  398. {
  399. return $this->status;
  400. }
  401. public function setStatus(int $status): static
  402. {
  403. $this->status = $status;
  404. return $this;
  405. }
  406. public function getSentMail(): ?string
  407. {
  408. return $this->sentMail;
  409. }
  410. public function setSentMail(?string $sentMail): static
  411. {
  412. $this->sentMail = $sentMail;
  413. return $this;
  414. }
  415. public function getParent(): ?self
  416. {
  417. return $this->parent;
  418. }
  419. public function setParent(?self $parent): static
  420. {
  421. $this->parent = $parent;
  422. return $this;
  423. }
  424. /**
  425. * @return Collection<int, self>
  426. */
  427. public function getQuotes(): Collection
  428. {
  429. return $this->quotes;
  430. }
  431. public function addQuote(self $quote): static
  432. {
  433. if (!$this->quotes->contains($quote)) {
  434. $this->quotes->add($quote);
  435. $quote->setParent($this);
  436. }
  437. return $this;
  438. }
  439. public function removeQuote(self $quote): static
  440. {
  441. if ($this->quotes->removeElement($quote)) {
  442. // set the owning side to null (unless already changed)
  443. if ($quote->getParent() === $this) {
  444. $quote->setParent(null);
  445. }
  446. }
  447. return $this;
  448. }
  449. }