src/Entity/TenantConfig.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TenantConfigRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity(repositoryClass=TenantConfigRepository::class)
  7. *
  8. * @ORM\HasLifecycleCallbacks()
  9. *
  10. * @SuppressWarnings(PHPMD.TooManyFields)
  11. */
  12. class TenantConfig {
  13. use MetaTrait;
  14. /**
  15. * @ORM\Id
  16. *
  17. * @ORM\GeneratedValue
  18. *
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\OneToOne(targetEntity=Tenant::class, inversedBy="tenantConfig", cascade={"persist", "remove"})
  24. *
  25. * @ORM\JoinColumn(nullable=false)
  26. */
  27. private $tenant;
  28. /**
  29. * @ORM\Column(type="string", length=255, nullable=true)
  30. */
  31. private $logo;
  32. /**
  33. * @ORM\Column(type="string", length=255, nullable=true)
  34. */
  35. private $favicon;
  36. /**
  37. * @ORM\Column(type="text", nullable=true)
  38. */
  39. private $footerAddress;
  40. /**
  41. * @ORM\Column(type="string", length=255, nullable=true)
  42. */
  43. private $facebookLink;
  44. /**
  45. * @ORM\Column(type="string", length=255, nullable=true)
  46. */
  47. private $instagramLink;
  48. /**
  49. * @ORM\Column(type="string", length=255, nullable=true)
  50. */
  51. private $linkedinLink;
  52. /**
  53. * @ORM\Column(type="string", length=255, nullable=true)
  54. */
  55. private $xingLink;
  56. /**
  57. * @ORM\Column(type="string", length=50, nullable=true)
  58. */
  59. private $color;
  60. /**
  61. * @ORM\Column(type="string", length=255, nullable=true)
  62. */
  63. private $colorHover;
  64. /**
  65. * @ORM\Column(type="string", length=255, nullable=true)
  66. */
  67. private $dTrustLink;
  68. /**
  69. * @ORM\Column(type="string", length=255, nullable=true)
  70. */
  71. private $applicationPortalLink;
  72. /**
  73. * @ORM\Column(type="string", length=255, nullable=true)
  74. */
  75. private $checklistLink;
  76. /**
  77. * @ORM\Column(type="string", length=255)
  78. */
  79. private $backLink;
  80. /**
  81. * @ORM\Column(type="string", length=255, nullable=true)
  82. */
  83. private $applyForEhbaLink;
  84. /**
  85. * @ORM\Column(type="string", length=255, nullable=true)
  86. */
  87. private $orderEhbaLink;
  88. /**
  89. * @ORM\Column(type="string", length=255, nullable=true)
  90. */
  91. private $applyForSmcbLink;
  92. /**
  93. * @ORM\Column(type="string", length=255, nullable=true)
  94. */
  95. private $orderSmcbLink;
  96. /**
  97. * @ORM\Column(type="string", length=255, nullable=true)
  98. */
  99. private $agb;
  100. /**
  101. * @ORM\Column(type="string", length=255, nullable=true)
  102. */
  103. private $besgb;
  104. /**
  105. * @ORM\Column(type="string", length=255, nullable=true)
  106. */
  107. private $kimAgb;
  108. /**
  109. * @ORM\Column(type="string", length=255, nullable=true)
  110. */
  111. private $avContract;
  112. /**
  113. * @ORM\Column(type="boolean")
  114. */
  115. private $enableCustomerNumber;
  116. /**
  117. * @ORM\Column(type="string", length=255, nullable=true)
  118. */
  119. private $imprintUrl;
  120. /**
  121. * @ORM\Column(type="string", length=255, nullable=true)
  122. */
  123. private $privacyUrl;
  124. /**
  125. * @ORM\Column(type="string", length=255, nullable=true)
  126. */
  127. private $customerFile;
  128. /**
  129. * @ORM\Column(type="string", length=255, nullable=true)
  130. */
  131. private $indexImage;
  132. /**
  133. * @ORM\Column(type="string", length=255, nullable=true)
  134. */
  135. private $subImage;
  136. public function getId(): ?int {
  137. return $this->id;
  138. }
  139. public function getTenant(): ?Tenant {
  140. return $this->tenant;
  141. }
  142. public function setTenant(Tenant $tenant): self {
  143. $this->tenant = $tenant;
  144. return $this;
  145. }
  146. public function getLogo(): ?string {
  147. return $this->logo;
  148. }
  149. public function setLogo(?string $logo): self {
  150. $this->logo = $logo;
  151. return $this;
  152. }
  153. public function getFavicon(): ?string {
  154. return $this->favicon;
  155. }
  156. public function setFavicon(?string $favicon): self {
  157. $this->favicon = $favicon;
  158. return $this;
  159. }
  160. public function getFooterAddress(): ?string {
  161. return $this->footerAddress;
  162. }
  163. public function setFooterAddress(?string $footerAddress): self {
  164. $this->footerAddress = $footerAddress;
  165. return $this;
  166. }
  167. /**
  168. * @ORM\PrePersist
  169. */
  170. public function setDefaults(): self {
  171. return $this
  172. ->setCreatedAt(new \DateTime())
  173. ;
  174. }
  175. /**
  176. * @ORM\PreUpdate
  177. */
  178. public function setModified(): self {
  179. return $this
  180. ->setModifiedAt(new \DateTime())
  181. ;
  182. }
  183. public function getFacebookLink(): ?string {
  184. return $this->facebookLink;
  185. }
  186. public function setFacebookLink(?string $facebookLink): self {
  187. $this->facebookLink = $facebookLink;
  188. return $this;
  189. }
  190. public function getInstagramLink(): ?string {
  191. return $this->instagramLink;
  192. }
  193. public function setInstagramLink(?string $instagramLink): self {
  194. $this->instagramLink = $instagramLink;
  195. return $this;
  196. }
  197. public function getLinkedinLink(): ?string {
  198. return $this->linkedinLink;
  199. }
  200. public function setLinkedinLink(?string $linkedinLink): self {
  201. $this->linkedinLink = $linkedinLink;
  202. return $this;
  203. }
  204. public function getXingLink(): ?string {
  205. return $this->xingLink;
  206. }
  207. public function setXingLink(?string $xingLink): self {
  208. $this->xingLink = $xingLink;
  209. return $this;
  210. }
  211. public function getColor(): ?string {
  212. return $this->color;
  213. }
  214. public function setColor(?string $color): self {
  215. $this->color = $color;
  216. return $this;
  217. }
  218. public function getColorHover(): ?string {
  219. return $this->colorHover;
  220. }
  221. public function setColorHover(?string $colorHover): self {
  222. $this->colorHover = $colorHover;
  223. return $this;
  224. }
  225. public function getDTrustLink(): ?string {
  226. return $this->dTrustLink;
  227. }
  228. public function setDTrustLink(?string $dTrustLink): self {
  229. $this->dTrustLink = $dTrustLink;
  230. return $this;
  231. }
  232. public function getApplicationPortalLink(): ?string {
  233. return $this->applicationPortalLink;
  234. }
  235. public function setApplicationPortalLink(?string $applicationPortalLink): self {
  236. $this->applicationPortalLink = $applicationPortalLink;
  237. return $this;
  238. }
  239. public function getChecklistLink(): ?string {
  240. return $this->checklistLink;
  241. }
  242. public function setChecklistLink(?string $checklistLink): self {
  243. $this->checklistLink = $checklistLink;
  244. return $this;
  245. }
  246. public function getBackLink(): ?string {
  247. return $this->backLink;
  248. }
  249. public function setBackLink(string $backLink): self {
  250. $this->backLink = $backLink;
  251. return $this;
  252. }
  253. public function getApplyForEhbaLink(): ?string {
  254. return $this->applyForEhbaLink;
  255. }
  256. public function setApplyForEhbaLink(?string $applyForEhbaLink): self {
  257. $this->applyForEhbaLink = $applyForEhbaLink;
  258. return $this;
  259. }
  260. public function getOrderEhbaLink(): ?string {
  261. return $this->orderEhbaLink;
  262. }
  263. public function setOrderEhbaLink(?string $orderEhbaLink): self {
  264. $this->orderEhbaLink = $orderEhbaLink;
  265. return $this;
  266. }
  267. public function getApplyForSmcbLink(): ?string {
  268. return $this->applyForSmcbLink;
  269. }
  270. public function setApplyForSmcbLink(?string $applyForSmcbLink): self {
  271. $this->applyForSmcbLink = $applyForSmcbLink;
  272. return $this;
  273. }
  274. public function getOrderSmcbLink(): ?string {
  275. return $this->orderSmcbLink;
  276. }
  277. public function setOrderSmcbLink(?string $orderSmcbLink): self {
  278. $this->orderSmcbLink = $orderSmcbLink;
  279. return $this;
  280. }
  281. public function getAgb(): ?string {
  282. return $this->agb;
  283. }
  284. public function setAgb(?string $agb): self {
  285. $this->agb = $agb;
  286. return $this;
  287. }
  288. public function getBesgb(): ?string {
  289. return $this->besgb;
  290. }
  291. public function setBesgb(?string $besgb): self {
  292. $this->besgb = $besgb;
  293. return $this;
  294. }
  295. public function getKimAgb(): ?string {
  296. return $this->kimAgb;
  297. }
  298. public function setKimAgb(?string $kimAgb): self {
  299. $this->kimAgb = $kimAgb;
  300. return $this;
  301. }
  302. public function getAvContract(): ?string {
  303. return $this->avContract;
  304. }
  305. public function setAvContract(?string $avContract): self {
  306. $this->avContract = $avContract;
  307. return $this;
  308. }
  309. public function getEnableCustomerNumber(): ?bool {
  310. return $this->enableCustomerNumber;
  311. }
  312. public function setEnableCustomerNumber(bool $enableCustomerNumber): self {
  313. $this->enableCustomerNumber = $enableCustomerNumber;
  314. return $this;
  315. }
  316. public function getImprintUrl(): ?string {
  317. return $this->imprintUrl;
  318. }
  319. public function setImprintUrl(?string $imprintUrl): self {
  320. $this->imprintUrl = $imprintUrl;
  321. return $this;
  322. }
  323. public function getPrivacyUrl(): ?string {
  324. return $this->privacyUrl;
  325. }
  326. public function setPrivacyUrl(?string $privacyUrl): self {
  327. $this->privacyUrl = $privacyUrl;
  328. return $this;
  329. }
  330. public function getCustomerFile(): ?string {
  331. return $this->customerFile;
  332. }
  333. public function setCustomerFile(?string $customerFile): self {
  334. $this->customerFile = $customerFile;
  335. return $this;
  336. }
  337. public function getIndexImage(): ?string {
  338. return $this->indexImage;
  339. }
  340. public function setIndexImage(?string $indexImage): self {
  341. $this->indexImage = $indexImage;
  342. return $this;
  343. }
  344. public function getSubImage(): ?string {
  345. return $this->subImage;
  346. }
  347. public function setSubImage(?string $subImage): self {
  348. $this->subImage = $subImage;
  349. return $this;
  350. }
  351. public function getContrastColor(): string {
  352. return $this->calcContrastColor($this->getColor());
  353. }
  354. private function calcContrastColor(string $hexColor): string {
  355. $hex = ltrim($hexColor, '#');
  356. $red = hexdec(substr($hex, 0, 2)) / 255;
  357. $green = hexdec(substr($hex, 2, 2)) / 255;
  358. $blue = hexdec(substr($hex, 4, 2)) / 255;
  359. $luminance = 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
  360. return $luminance > 0.5
  361. ? '#000000'
  362. : '#ffffff';
  363. }
  364. }