Deprecated: Symfony\Component\Translation\t(): Implicitly marking parameter $domain as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/translation/Resources/functions.php on line 18

Deprecated: Symfony\Component\Dotenv\Dotenv::loadEnv(): Implicitly marking parameter $envKey as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/dotenv/Dotenv.php on line 110

Deprecated: Symfony\Component\Runtime\GenericRuntime::getResolver(): Implicitly marking parameter $reflector as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/runtime/GenericRuntime.php on line 89

Deprecated: Symfony\Component\Runtime\RuntimeInterface::getResolver(): Implicitly marking parameter $reflector as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/runtime/RuntimeInterface.php on line 26

Deprecated: Symfony\Component\Console\Input\ArgvInput::__construct(): Implicitly marking parameter $argv as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/ArgvInput.php on line 46

Deprecated: Symfony\Component\Console\Input\ArgvInput::__construct(): Implicitly marking parameter $definition as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/ArgvInput.php on line 46

Deprecated: Symfony\Component\Console\Input\Input::__construct(): Implicitly marking parameter $definition as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/Input.php on line 36

Deprecated: Constant E_STRICT is deprecated in /var/www/html/t/taurushr/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/html/t/taurushr/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/DTO/LandingPageBlock.php line 7

Open in your IDE?
  1. <?php
  2. namespace App\DTO;
  3. use Symfony\Component\Validator\Constraints as Assert;
  4. class LandingPageBlock
  5. {
  6.     /**
  7.      * @var string|null
  8.      * @Assert\NotBlank(message="Please enter a title")
  9.      */
  10.     private $title;
  11.     /**
  12.      * @var string|null
  13.      * @Assert\NotBlank(message="Please enter content")
  14.      */
  15.     private $content;
  16.     /**
  17.      * @var string|null
  18.      */
  19.     private $image;
  20.     /**
  21.      * @var string|null
  22.      */
  23.     private $ctaText;
  24.     /**
  25.      * @var string|null
  26.      */
  27.     private $ctaLink;
  28.     /**
  29.      * @var string|null
  30.      * @Assert\Choice(choices={"Image Left", "Image Right"}, message="Please select a valid layout")
  31.      */
  32.     private $layout;
  33.     public function getTitle(): ?string
  34.     {
  35.         return $this->title;
  36.     }
  37.     public function setTitle(?string $title): self
  38.     {
  39.         $this->title $title;
  40.         return $this;
  41.     }
  42.     public function getContent(): ?string
  43.     {
  44.         return $this->content;
  45.     }
  46.     public function setContent(?string $content): self
  47.     {
  48.         $this->content $content;
  49.         return $this;
  50.     }
  51.     public function getImage(): ?string
  52.     {
  53.         return $this->image;
  54.     }
  55.     public function setImage(?string $image): self
  56.     {
  57.         $this->image $image;
  58.         return $this;
  59.     }
  60.     public function getCtaText(): ?string
  61.     {
  62.         return $this->ctaText;
  63.     }
  64.     public function setCtaText(?string $ctaText): self
  65.     {
  66.         $this->ctaText $ctaText;
  67.         return $this;
  68.     }
  69.     public function getCtaLink(): ?string
  70.     {
  71.         return $this->ctaLink;
  72.     }
  73.     public function setCtaLink(?string $ctaLink): self
  74.     {
  75.         $this->ctaLink $ctaLink;
  76.         return $this;
  77.     }
  78.     public function getLayout(): ?string
  79.     {
  80.         return $this->layout;
  81.     }
  82.     public function setLayout(?string $layout): self
  83.     {
  84.         $this->layout $layout;
  85.         return $this;
  86.     }
  87.     public static function arrayToEntity(array $data): array
  88.     {
  89.         $array = [];
  90.         foreach ($data as $item) {
  91.             $block = new LandingPageBlock();
  92.             $block->setTitle($item['title'] ?? null);
  93.             $block->setContent($item['content'] ?? null);
  94.             $block->setImage($item['image'] ?? null);
  95.             $block->setCtaText($item['ctaText'] ?? null);
  96.             $block->setCtaLink($item['ctaLink'] ?? null);
  97.             $block->setLayout($item['layout'] ?? null);
  98.             $array[] = $block;
  99.         }
  100.         return $array;
  101.     }
  102.     public static function EntitiesToArray(array $entities): array
  103.     {
  104.         return array_map(function (LandingPageBlock $entity) {
  105.             return $entity->toArray();
  106.         }, $entities);
  107.     }
  108.     public function toArray(): array
  109.     {
  110.         return [
  111.             'title' => $this->title,
  112.             'content' => $this->content,
  113.             'image' => $this->image,
  114.             'ctaText' => $this->ctaText,
  115.             'ctaLink' => $this->ctaLink,
  116.             'layout' => $this->layout,
  117.         ];
  118.     }
  119.     public function getFilePath(): string
  120.     {
  121.         return 'userfiles/images/page';
  122.     }
  123.     public function getFullImagePath(): string
  124.     {
  125.         return $this->getFilePath().'/'.$this->image;
  126.     }
  127. }