src/Entity/Core/WordoptionIcon.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JsonSerializable;
  7. #[ORM\Table(name: 'wordoption_icons')]
  8. #[ORM\Entity(repositoryClass: WordoptionIconRepository::class)]
  9. class WordoptionIcon implements JsonSerializable
  10. {
  11. /**
  12. * @var int
  13. */
  14. #[ORM\Column(name: 'id', type: 'integer')]
  15. #[ORM\Id]
  16. #[ORM\GeneratedValue(strategy: 'AUTO')]
  17. private $id;
  18. /**
  19. * @var string
  20. */
  21. #[ORM\Column(name: 'abbreviation', type: 'string', length: 255, unique: true)]
  22. private $abbreviation;
  23. /**
  24. * @var string
  25. */
  26. #[ORM\Column(name: 'icon', type: 'string', length: 255, nullable: true)]
  27. private $icon;
  28. /**
  29. * @var string
  30. */
  31. #[ORM\Column(name: 'description', type: 'string', length: 255, nullable: true)]
  32. private $description;
  33. /**
  34. * @var string
  35. */
  36. #[ORM\Column(name: 'display', type: 'string', length: 255, options: ['default' => 'both'])]
  37. private $display;
  38. public function getId(): int
  39. {
  40. return $this->id;
  41. }
  42. /**
  43. * @return void
  44. */
  45. public function setAbbreviation(string $abbreviation)
  46. {
  47. $this->abbreviation = $abbreviation;
  48. }
  49. public function getAbbreviation(): string
  50. {
  51. return $this->abbreviation;
  52. }
  53. public function getIcon(): string
  54. {
  55. return $this->icon;
  56. }
  57. public function setIcon(string $icon): void
  58. {
  59. $this->icon = $icon;
  60. }
  61. public function getDescription(): string
  62. {
  63. return $this->description;
  64. }
  65. public function setDescription(string $description): void
  66. {
  67. $this->description = $description;
  68. }
  69. public function getDisplay(): string
  70. {
  71. return $this->display;
  72. }
  73. public function setDisplay(string $display): void
  74. {
  75. $this->display = $display;
  76. }
  77. public function jsonSerialize(): mixed
  78. {
  79. return [
  80. "id" => $this->id,
  81. "abbreviation" => $this->abbreviation,
  82. "icon" => "http://{$_SERVER['HTTP_HOST']}/assets/wordoption_icons/core/{$this->icon}",
  83. "description" => $this->description,
  84. "display" => $this->display
  85. ];
  86. }
  87. }