src/Entity/Application/Information.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Application;
  3. use App\Repository\Application\InformationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use App\Entity\User;
  9. use JMS\Serializer\Annotation as Serializer;
  10. use App\Entity\Behaviors\TranslatableTrait;
  11. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  12. /**
  13. *
  14. * @ORM\Table(name="app_information")
  15. * @ORM\EntityListeners({"App\Listener\EntityListener"})
  16. * @ORM\Entity(repositoryClass=InformationRepository::class)
  17. * @Vich\Uploadable()
  18. */
  19. class Information implements TranslatableInterface
  20. {
  21. use TranslatableTrait;
  22. /**
  23. * @ORM\Id
  24. * @ORM\GeneratedValue
  25. * @ORM\Column(type="integer")
  26. */
  27. private $id;
  28. /**
  29. * @Serializer\Groups({"api"})
  30. * @Serializer\SerializedName("name")
  31. * @ORM\Column(type="string", length=190)
  32. */
  33. private $name;
  34. /**
  35. * @Serializer\Groups({"api"})
  36. * @Serializer\SerializedName("secondName")
  37. * @ORM\Column(type="string", length=190)
  38. */
  39. private $secondName;
  40. /**
  41. * @Serializer\Groups({"api"})
  42. * @Serializer\SerializedName("phone")
  43. * @ORM\Column(type="string", length=100)
  44. */
  45. private $phone;
  46. /**
  47. * @Serializer\Groups({"api"})
  48. * @Serializer\SerializedName("email")
  49. * @ORM\Column(type="string", length=150)
  50. */
  51. private $email;
  52. /**
  53. * @Serializer\Groups({"api"})
  54. * @Serializer\SerializedName("gps")
  55. * @ORM\Column(type="string", length=150)
  56. */
  57. private $gps;
  58. /**
  59. * @Serializer\Groups({"api"})
  60. * @Serializer\SerializedName("lat")
  61. * @ORM\Column(type="float")
  62. */
  63. private $lat;
  64. /**
  65. * @Serializer\Groups({"api"})
  66. * @Serializer\SerializedName("lng")
  67. * @ORM\Column(type="float")
  68. */
  69. private $lng;
  70. /**
  71. * @ORM\Column(type="text", nullable=true)
  72. */
  73. private $b2b;
  74. /**
  75. * @Serializer\Groups({"api"})
  76. * @Serializer\SerializedName("address")
  77. * @ORM\Column(type="string")
  78. */
  79. private $address;
  80. /**
  81. * @Serializer\Groups({"api"})
  82. * @Serializer\SerializedName("zip")
  83. * @ORM\Column(type="string")
  84. */
  85. private $zip;
  86. /**
  87. * @Vich\UploadableField(mapping="store_logo", fileNameProperty="logo")
  88. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  89. * @var File|null
  90. */
  91. private $logoFile;
  92. /**
  93. * @Serializer\Groups({"api"})
  94. * @Serializer\SerializedName("logo")
  95. * @ORM\Column(type="string", length=255, nullable=true)
  96. */
  97. private $logo;
  98. /**
  99. * @ORM\Column(type="datetime")
  100. */
  101. private $createts;
  102. /**
  103. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  104. * @ORM\JoinColumn(nullable=true)
  105. */
  106. private $createUser;
  107. /**
  108. * @ORM\Column(type="datetime", nullable=true)
  109. */
  110. private $editts;
  111. /**
  112. * @ORM\ManyToOne(targetEntity="App\Entity\User")
  113. */
  114. private $editUser;
  115. /**
  116. * @Vich\UploadableField(mapping="information_image", fileNameProperty="image1")
  117. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  118. * @var File|null
  119. */
  120. private $image1File;
  121. /**
  122. * @ORM\Column(type="string", length=255, nullable=true)
  123. */
  124. private $image1;
  125. /**
  126. * @Vich\UploadableField(mapping="information_image", fileNameProperty="image2")
  127. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  128. * @var File|null
  129. */
  130. private $image2File;
  131. /**
  132. * @ORM\Column(type="string", length=255, nullable=true)
  133. */
  134. private $image2;
  135. /**
  136. * @Vich\UploadableField(mapping="information_image", fileNameProperty="image3")
  137. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  138. * @var File|null
  139. */
  140. private $image3File;
  141. /**
  142. * @ORM\Column(type="string", length=255, nullable=true)
  143. */
  144. private $image3;
  145. /**
  146. * @Vich\UploadableField(mapping="information_image", fileNameProperty="image4")
  147. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  148. * @var File|null
  149. */
  150. private $image4File;
  151. /**
  152. * @ORM\Column(type="string", length=255, nullable=true)
  153. */
  154. private $image4;
  155. /**
  156. * @Vich\UploadableField(mapping="information_image", fileNameProperty="image5")
  157. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  158. * @var File|null
  159. */
  160. private $image5File;
  161. /**
  162. * @ORM\Column(type="string", length=255, nullable=true)
  163. */
  164. private $image5;
  165. /**
  166. * @Vich\UploadableField(mapping="information_image", fileNameProperty="image6")
  167. * @Assert\Image(mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  168. * @var File|null
  169. */
  170. private $image6File;
  171. /**
  172. * @ORM\Column(type="string", length=255, nullable=true)
  173. */
  174. private $image6;
  175. /**
  176. * @Serializer\Groups({"api"})
  177. * @Serializer\SerializedName("images")
  178. */
  179. private $images;
  180. /**
  181. * @ORM\Column(type="time", nullable=true)
  182. */
  183. private $openFrom;
  184. /**
  185. * @ORM\Column(type="time", nullable=true)
  186. */
  187. private $openTo;
  188. /**
  189. * @ORM\Column(type="array", nullable=true)
  190. */
  191. private $opening;
  192. /**
  193. * @Serializer\VirtualProperty()
  194. * @Serializer\Groups({"api"})
  195. * @Serializer\Inline()
  196. */
  197. public function getVirtualTranslation()
  198. {
  199. return $this->translate();
  200. }
  201. /**
  202. * @Serializer\VirtualProperty()
  203. * @Serializer\Groups({"api"})
  204. * @Serializer\SerializedName("openHours")
  205. */
  206. public function getVirtualOpenHoursToday()
  207. {
  208. $out = [];
  209. foreach ($this->getOpening() as $item) {
  210. $out[]=implode(' - ',$item);
  211. }
  212. return $out;
  213. }
  214. public function __call($method, $arguments)
  215. {
  216. $ret = $this->proxyCurrentLocaleTranslation($method, $arguments);
  217. if(empty($ret)) {
  218. $ret = call_user_func_array( [ $this->translate( \Locale::getDefault() ), $method ], $arguments );
  219. }
  220. return $ret;
  221. }
  222. public function getId(): ?int
  223. {
  224. return $this->id;
  225. }
  226. public function getName(): ?string
  227. {
  228. return $this->name;
  229. }
  230. public function setName(string $name): self
  231. {
  232. $this->name = $name;
  233. return $this;
  234. }
  235. public function getPhone(): ?string
  236. {
  237. return $this->phone;
  238. }
  239. public function setPhone(string $phone): self
  240. {
  241. $this->phone = $phone;
  242. return $this;
  243. }
  244. public function getEmail(): ?string
  245. {
  246. return $this->email;
  247. }
  248. public function setEmail(string $email): self
  249. {
  250. $this->email = $email;
  251. return $this;
  252. }
  253. public function getGps(): ?string
  254. {
  255. return $this->gps;
  256. }
  257. public function setGps(string $gps): self
  258. {
  259. $this->gps = $gps;
  260. return $this;
  261. }
  262. public function getAddress(): ?string
  263. {
  264. return $this->address;
  265. }
  266. public function setAddress(string $address): self
  267. {
  268. $this->address = $address;
  269. return $this;
  270. }
  271. public function getLogo(): ?string
  272. {
  273. return $this->logo;
  274. }
  275. public function setLogo(?string $logo): self
  276. {
  277. $this->logo = $logo;
  278. return $this;
  279. }
  280. public function getCreatets(): ?\DateTimeInterface
  281. {
  282. return $this->createts;
  283. }
  284. public function setCreatets(\DateTimeInterface $createts): self
  285. {
  286. $this->createts = $createts;
  287. return $this;
  288. }
  289. public function getCreateUser(): ?User
  290. {
  291. return $this->createUser;
  292. }
  293. public function setCreateUser(?User $createUser): self
  294. {
  295. $this->createUser = $createUser;
  296. return $this;
  297. }
  298. public function getEditts(): ?\DateTimeInterface
  299. {
  300. return $this->editts;
  301. }
  302. public function setEditts(?\DateTimeInterface $editts): self
  303. {
  304. $this->editts = $editts;
  305. return $this;
  306. }
  307. public function getEditUser(): ?User
  308. {
  309. return $this->editUser;
  310. }
  311. public function setEditUser(?User $editUser): self
  312. {
  313. $this->editUser = $editUser;
  314. return $this;
  315. }
  316. /**
  317. * Get ImageFile
  318. *
  319. * @return null|File
  320. */
  321. public function getLogoFile(): ?File
  322. {
  323. return $this->logoFile;
  324. }
  325. /**
  326. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $logoFile
  327. */
  328. public function setLogoFile(?File $logoFile = null): void
  329. {
  330. $this->logoFile = $logoFile;
  331. if (null !== $logoFile) {
  332. $this->editts = new \DateTime();
  333. }
  334. }
  335. /**
  336. * Get Image1File
  337. *
  338. * @return null|File
  339. */
  340. public function getImage1File(): ?File
  341. {
  342. return $this->image1File;
  343. }
  344. /**
  345. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $image1File
  346. */
  347. public function setImage1File(?File $image1File = null): void
  348. {
  349. $this->image1File = $image1File;
  350. if (null !== $image1File) {
  351. $this->editts = new \DateTime();
  352. }
  353. }
  354. /**
  355. * Get Image1
  356. *
  357. * @return mixed
  358. */
  359. public function getImage1()
  360. {
  361. return $this->image1;
  362. }
  363. /**
  364. * Set Image1
  365. *
  366. * @param mixed $image1
  367. */
  368. public function setImage1( $image1 )
  369. {
  370. $this->image1 = $image1;
  371. }
  372. /**
  373. * Get Image2File
  374. *
  375. * @return null|File
  376. */
  377. public function getImage2File(): ?File
  378. {
  379. return $this->image2File;
  380. }
  381. /**
  382. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $image2File
  383. */
  384. public function setImage2File(?File $image2File = null): void
  385. {
  386. $this->image2File = $image2File;
  387. if (null !== $image2File) {
  388. $this->editts = new \DateTime();
  389. }
  390. }
  391. /**
  392. * Get Image2
  393. *
  394. * @return mixed
  395. */
  396. public function getImage2()
  397. {
  398. return $this->image2;
  399. }
  400. /**
  401. * Set Image2
  402. *
  403. * @param mixed $image2
  404. */
  405. public function setImage2( $image2 )
  406. {
  407. $this->image2 = $image2;
  408. }
  409. /**
  410. * Get Image3File
  411. *
  412. * @return null|File
  413. */
  414. public function getImage3File(): ?File
  415. {
  416. return $this->image3File;
  417. }
  418. /**
  419. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $image3File
  420. */
  421. public function setImage3File(?File $image3File = null): void
  422. {
  423. $this->image3File = $image3File;
  424. if (null !== $image3File) {
  425. $this->editts = new \DateTime();
  426. }
  427. }
  428. /**
  429. * Get Image3
  430. *
  431. * @return mixed
  432. */
  433. public function getImage3()
  434. {
  435. return $this->image3;
  436. }
  437. /**
  438. * Set Image3
  439. *
  440. * @param mixed $image3
  441. */
  442. public function setImage3( $image3 )
  443. {
  444. $this->image3 = $image3;
  445. }
  446. /**
  447. * Get Image4File
  448. *
  449. * @return null|File
  450. */
  451. public function getImage4File(): ?File
  452. {
  453. return $this->image4File;
  454. }
  455. /**
  456. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $image4File
  457. */
  458. public function setImage4File(?File $image4File = null): void
  459. {
  460. $this->image4File = $image4File;
  461. if (null !== $image4File) {
  462. $this->editts = new \DateTime();
  463. }
  464. }
  465. /**
  466. * Get Image4
  467. *
  468. * @return mixed
  469. */
  470. public function getImage4()
  471. {
  472. return $this->image4;
  473. }
  474. /**
  475. * Set Image4
  476. *
  477. * @param mixed $image4
  478. */
  479. public function setImage4( $image4 )
  480. {
  481. $this->image4 = $image4;
  482. }
  483. /**
  484. * Get Image5File
  485. *
  486. * @return null|File
  487. */
  488. public function getImage5File(): ?File
  489. {
  490. return $this->image5File;
  491. }
  492. /**
  493. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $image5File
  494. */
  495. public function setImage5File(?File $image5File = null): void
  496. {
  497. $this->image5File = $image5File;
  498. if (null !== $image5File) {
  499. $this->editts = new \DateTime();
  500. }
  501. }
  502. /**
  503. * Get Image5
  504. *
  505. * @return mixed
  506. */
  507. public function getImage5()
  508. {
  509. return $this->image5;
  510. }
  511. /**
  512. * Set Image5
  513. *
  514. * @param mixed $image5
  515. */
  516. public function setImage5( $image5 )
  517. {
  518. $this->image5 = $image5;
  519. }
  520. /**
  521. * Get Image6File
  522. *
  523. * @return null|File
  524. */
  525. public function getImage6File(): ?File
  526. {
  527. return $this->image6File;
  528. }
  529. /**
  530. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $image6File
  531. */
  532. public function setImage6File(?File $image6File = null): void
  533. {
  534. $this->image6File = $image6File;
  535. if (null !== $image6File) {
  536. $this->editts = new \DateTime();
  537. }
  538. }
  539. /**
  540. * Get Image6
  541. *
  542. * @return mixed
  543. */
  544. public function getImage6()
  545. {
  546. return $this->image6;
  547. }
  548. /**
  549. * Set Image6
  550. *
  551. * @param mixed $image6
  552. */
  553. public function setImage6( $image6 )
  554. {
  555. $this->image6 = $image6;
  556. }
  557. /**
  558. * Get Images
  559. *
  560. * @return mixed
  561. */
  562. public function getImages()
  563. {
  564. return $this->images;
  565. }
  566. /**
  567. * Set Images
  568. *
  569. * @param mixed $images
  570. */
  571. public function setImages( $images )
  572. {
  573. $this->images = $images;
  574. }
  575. /**
  576. * Get Lat
  577. *
  578. * @return mixed
  579. */
  580. public function getLat()
  581. {
  582. return $this->lat;
  583. }
  584. /**
  585. * Set Lat
  586. *
  587. * @param mixed $lat
  588. */
  589. public function setLat( $lat )
  590. {
  591. $this->lat = $lat;
  592. }
  593. /**
  594. * Get Lng
  595. *
  596. * @return mixed
  597. */
  598. public function getLng()
  599. {
  600. return $this->lng;
  601. }
  602. /**
  603. * Set Lng
  604. *
  605. * @param mixed $lng
  606. */
  607. public function setLng( $lng )
  608. {
  609. $this->lng = $lng;
  610. }
  611. /**
  612. * Get Zip
  613. *
  614. * @return mixed
  615. */
  616. public function getZip()
  617. {
  618. return $this->zip;
  619. }
  620. /**
  621. * Set Zip
  622. *
  623. * @param mixed $zip
  624. */
  625. public function setZip( $zip )
  626. {
  627. $this->zip = $zip;
  628. }
  629. /**
  630. * Get SecondName
  631. *
  632. * @return mixed
  633. */
  634. public function getSecondName()
  635. {
  636. return $this->secondName;
  637. }
  638. /**
  639. * Set SecondName
  640. *
  641. * @param mixed $secondName
  642. */
  643. public function setSecondName( $secondName )
  644. {
  645. $this->secondName = $secondName;
  646. }
  647. /**
  648. * @return mixed
  649. */
  650. public function getOpenFrom()
  651. {
  652. return $this->openFrom;
  653. }
  654. /**
  655. * @param mixed $openFrom
  656. */
  657. public function setOpenFrom($openFrom): void
  658. {
  659. $this->openFrom = $openFrom;
  660. }
  661. /**
  662. * @return mixed
  663. */
  664. public function getOpenTo()
  665. {
  666. return $this->openTo;
  667. }
  668. /**
  669. * @param mixed $openTo
  670. */
  671. public function setOpenTo($openTo): void
  672. {
  673. $this->openTo = $openTo;
  674. }
  675. /**
  676. * @return mixed
  677. */
  678. public function getB2b()
  679. {
  680. return $this->b2b;
  681. }
  682. /**
  683. * @param mixed $b2b
  684. */
  685. public function setB2b($b2b): void
  686. {
  687. $this->b2b = $b2b;
  688. }
  689. /**
  690. * @return mixed
  691. */
  692. public function getOpening()
  693. {
  694. if($this->opening === null){
  695. return [];
  696. }
  697. return $this->opening;
  698. }
  699. /**
  700. * @param mixed $opening
  701. */
  702. public function setOpening($opening): void
  703. {
  704. $this->opening = $opening;
  705. }
  706. }