src/VendorBundle/Entity/Vendor.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\VendorBundle\Entity;
  3. use App\ContentBundle\Entity\Post;
  4. use App\MediaBundle\Entity\Image;
  5. use App\SeoBundle\Entity\Seo;
  6. use App\VendorBundle\Entity\Translation\VendorTranslation;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use PN\LocaleBundle\Model\LocaleTrait;
  11. use PN\LocaleBundle\Model\Translatable;
  12. use PN\ServiceBundle\Interfaces\DateTimeInterface;
  13. use PN\ServiceBundle\Model\DateTimeTrait;
  14. use PN\ServiceBundle\Model\VirtualDeleteTrait;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. /**
  17. * @ORM\Table("vendor")
  18. * @ORM\Entity(repositoryClass="App\VendorBundle\Repository\VendorRepository")
  19. */
  20. class Vendor implements Translatable, DateTimeInterface
  21. {
  22. use VirtualDeleteTrait,
  23. DateTimeTrait,
  24. LocaleTrait;
  25. /**
  26. * @ORM\Column(name="id", type="integer")
  27. * @ORM\Id
  28. * @ORM\GeneratedValue(strategy="AUTO")
  29. */
  30. private ?int $id = null;
  31. /**
  32. * @ORM\OneToOne(targetEntity="App\SeoBundle\Entity\Seo", cascade={"persist", "remove" })
  33. */
  34. private ?Seo $seo = null;
  35. /**
  36. * Description
  37. * @ORM\OneToOne(targetEntity="App\ContentBundle\Entity\Post", cascade={"persist", "remove" })
  38. */
  39. private ?Post $post = null;
  40. /**
  41. * @ORM\Column(name="title", type="string", length=255)
  42. */
  43. private ?string $title = null;
  44. /**
  45. * @ORM\Column(name="email", type="string", length=180, nullable=true)
  46. * @Assert\NotBlank
  47. * @Assert\Email(message="The email '{{ value }}' is not a valid email")
  48. * @Assert\Length(
  49. * min="2",
  50. * max="120",
  51. * minMessage="Your email must be at least {{ limit }} characters long",
  52. * maxMessage="Your email cannot be longer than {{ limit }} characters",
  53. * )
  54. */
  55. private ?string $email = null;
  56. /**
  57. * @ORM\Column(name="company_registration_number", type="string",nullable=true)
  58. */
  59. private ?string $companyRegistrationNumber = null;
  60. /**
  61. * @ORM\Column(name="sales_tax_number", type="string", length=11,nullable=true)
  62. */
  63. private ?string $salesTaxNumber = null;
  64. /**
  65. * @ORM\Column(name="bank_name", type="string",length=50,nullable=true)
  66. */
  67. private ?string $bankName = null;
  68. /**
  69. * @ORM\Column(name="bank_account_swift_code", type="string",length=50, nullable=true)
  70. */
  71. private ?string $bankAccountSwiftCode = null;
  72. /**
  73. * @ORM\Column(name="bank_account_iban", type="string",length=50, nullable=true)
  74. */
  75. private ?string $bankAccountIBAN = null;
  76. /**
  77. * @ORM\Column(type="string",length=50,nullable=true)
  78. */
  79. private ?string $bankBranch = null;
  80. /**
  81. * @ORM\Column(name="bank_account_no", type="string",length=50,nullable=true)
  82. */
  83. private ?string $bankAccountNo = null;
  84. /**
  85. * @ORM\Column(name="bank_account_holder_name", type="string",length=225,nullable=true)
  86. */
  87. private ?string $bankAccountHolderName = null;
  88. /**
  89. * @ORM\Column(name="commission_percentage", type="float")
  90. */
  91. private float $commissionPercentage = 0;
  92. /**
  93. * @ORM\Column(name="publish", type="boolean")
  94. */
  95. private bool $publish = false;
  96. /**
  97. * @ORM\OneToOne(targetEntity="App\MediaBundle\Entity\Image", cascade={"persist", "remove" })
  98. */
  99. private ?Image $image = null;
  100. /**
  101. * @ORM\OneToMany(targetEntity="App\VendorBundle\Entity\StoreAddress", mappedBy="vendor")
  102. */
  103. private Collection $storeAddresses;
  104. /**
  105. * @ORM\OneToMany(targetEntity="App\VendorBundle\Entity\Translation\VendorTranslation", mappedBy="translatable", cascade={"ALL"}, orphanRemoval=true)
  106. */
  107. private $translations;
  108. public function __construct()
  109. {
  110. $this->storeAddresses = new ArrayCollection();
  111. $this->translations = new ArrayCollection();
  112. }
  113. public function __toString()
  114. {
  115. return $this->getTitle();
  116. }
  117. public function getId()
  118. {
  119. return $this->id;
  120. }
  121. public function getTitle(): ?string
  122. {
  123. return $this->title;
  124. }
  125. public function setTitle(string $title): static
  126. {
  127. $this->title = $title;
  128. return $this;
  129. }
  130. public function isPublish(): ?bool
  131. {
  132. return $this->publish;
  133. }
  134. public function setPublish(bool $publish): static
  135. {
  136. $this->publish = $publish;
  137. return $this;
  138. }
  139. public function getSeo(): ?Seo
  140. {
  141. return $this->seo;
  142. }
  143. public function setSeo(?Seo $seo): static
  144. {
  145. $this->seo = $seo;
  146. return $this;
  147. }
  148. public function getPost(): ?Post
  149. {
  150. return $this->post;
  151. }
  152. public function setPost(?Post $post): static
  153. {
  154. $this->post = $post;
  155. return $this;
  156. }
  157. public function getImage(): ?Image
  158. {
  159. return $this->image;
  160. }
  161. public function setImage(?Image $image): static
  162. {
  163. $this->image = $image;
  164. return $this;
  165. }
  166. /**
  167. * @return Collection<int, StoreAddress>
  168. */
  169. public function getStoreAddresses(): Collection
  170. {
  171. return $this->storeAddresses;
  172. }
  173. public function addStoreAddress(StoreAddress $storeAddress): static
  174. {
  175. if (!$this->storeAddresses->contains($storeAddress)) {
  176. $this->storeAddresses->add($storeAddress);
  177. $storeAddress->setVendor($this);
  178. }
  179. return $this;
  180. }
  181. public function removeStoreAddress(StoreAddress $storeAddress): static
  182. {
  183. if ($this->storeAddresses->removeElement($storeAddress)) {
  184. // set the owning side to null (unless already changed)
  185. if ($storeAddress->getVendor() === $this) {
  186. $storeAddress->setVendor(null);
  187. }
  188. }
  189. return $this;
  190. }
  191. /**
  192. * @return Collection<int, VendorTranslation>
  193. */
  194. public function getTranslations(): Collection
  195. {
  196. return $this->translations;
  197. }
  198. public function addTranslation(VendorTranslation $translation): static
  199. {
  200. if (!$this->translations->contains($translation)) {
  201. $this->translations->add($translation);
  202. $translation->setTranslatable($this);
  203. }
  204. return $this;
  205. }
  206. public function removeTranslation(VendorTranslation $translation): static
  207. {
  208. if ($this->translations->removeElement($translation)) {
  209. // set the owning side to null (unless already changed)
  210. if ($translation->getTranslatable() === $this) {
  211. $translation->setTranslatable(null);
  212. }
  213. }
  214. return $this;
  215. }
  216. public function getCommissionPercentage(): ?float
  217. {
  218. return $this->commissionPercentage;
  219. }
  220. public function setCommissionPercentage(float $commissionPercentage): static
  221. {
  222. $this->commissionPercentage = $commissionPercentage;
  223. return $this;
  224. }
  225. public function getEmail(): ?string
  226. {
  227. return $this->email;
  228. }
  229. public function setEmail(string $email): static
  230. {
  231. $this->email = $email;
  232. return $this;
  233. }
  234. public function getCompanyRegistrationNumber(): ?string
  235. {
  236. return $this->companyRegistrationNumber;
  237. }
  238. public function setCompanyRegistrationNumber(?string $companyRegistrationNumber): static
  239. {
  240. $this->companyRegistrationNumber = $companyRegistrationNumber;
  241. return $this;
  242. }
  243. public function getSalesTaxNumber(): ?string
  244. {
  245. return $this->salesTaxNumber;
  246. }
  247. public function setSalesTaxNumber(?string $salesTaxNumber): static
  248. {
  249. $this->salesTaxNumber = $salesTaxNumber;
  250. return $this;
  251. }
  252. public function getBankName(): ?string
  253. {
  254. return $this->bankName;
  255. }
  256. public function setBankName(?string $bankName): static
  257. {
  258. $this->bankName = $bankName;
  259. return $this;
  260. }
  261. public function getBankAccountSwiftCode(): ?string
  262. {
  263. return $this->bankAccountSwiftCode;
  264. }
  265. public function setBankAccountSwiftCode(?string $bankAccountSwiftCode): static
  266. {
  267. $this->bankAccountSwiftCode = $bankAccountSwiftCode;
  268. return $this;
  269. }
  270. public function getBankAccountIBAN(): ?string
  271. {
  272. return $this->bankAccountIBAN;
  273. }
  274. public function setBankAccountIBAN(?string $bankAccountIBAN): static
  275. {
  276. $this->bankAccountIBAN = $bankAccountIBAN;
  277. return $this;
  278. }
  279. public function getBankBranch(): ?string
  280. {
  281. return $this->bankBranch;
  282. }
  283. public function setBankBranch(?string $bankBranch): static
  284. {
  285. $this->bankBranch = $bankBranch;
  286. return $this;
  287. }
  288. public function getBankAccountNo(): ?string
  289. {
  290. return $this->bankAccountNo;
  291. }
  292. public function setBankAccountNo(?string $bankAccountNo): static
  293. {
  294. $this->bankAccountNo = $bankAccountNo;
  295. return $this;
  296. }
  297. public function getBankAccountHolderName(): ?string
  298. {
  299. return $this->bankAccountHolderName;
  300. }
  301. public function setBankAccountHolderName(?string $bankAccountHolderName): static
  302. {
  303. $this->bankAccountHolderName = $bankAccountHolderName;
  304. return $this;
  305. }
  306. }