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/Entity/News.php line 30

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\LinkTrait;
  4. use App\Entity\Traits\MetaTrait;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Traits\ActiveTrait;
  7. use App\Entity\Traits\DeleteTrait;
  8. use App\Repository\NewsRepository;
  9. use App\Entity\Traits\SubTitleTrait;
  10. use App\Entity\Traits\TranslateTrait;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use App\Entity\Traits\ImageUploadTrait;
  13. use App\Entity\Traits\SitemapableTrait;
  14. use App\Entity\Traits\TitleAndContentTrait;
  15. use App\Entity\Interfaces\DefaultLinkedEntity;
  16. use Gedmo\Timestampable\Traits\TimestampableEntity;
  17. use Symfony\Component\Validator\Constraints as Assert;
  18. /**
  19.  * News.
  20.  *
  21.  * @Gedmo\Loggable
  22.  *
  23.  * @Gedmo\TranslationEntity(class="App\Entity\NewsTranslations")
  24.  */
  25. #[ORM\Entity(repositoryClassNewsRepository::class)]
  26. #[ORM\Table(name'news')]
  27. class News implements DefaultLinkedEntity
  28. {
  29.     use TitleAndContentTrait;
  30.     use SubTitleTrait;
  31.     use LinkTrait;
  32.     use MetaTrait;
  33.     use ActiveTrait;
  34.     use DeleteTrait;
  35.     use ImageUploadTrait;
  36.     use TimestampableEntity;
  37.     use TranslateTrait;
  38.     use SitemapableTrait;
  39.     public $imageUpload;
  40.     #[ORM\Column(name'id'type'integer')]
  41.     #[ORM\Id]
  42.     #[ORM\GeneratedValue(strategy'AUTO')]
  43.     private readonly int $id;
  44.     /**
  45.      * @Gedmo\Versioned
  46.      *
  47.      * @Gedmo\Translatable
  48.      */
  49.     #[ORM\Column(name'excerpt'type'text'nullabletrue)]
  50.     private ?string $excerpt null;
  51.     /**
  52.      * @Gedmo\Versioned
  53.      */
  54.     #[ORM\Column(name'publish_date'type'datetime')]
  55.     private ?\DateTimeInterface $publishDate null;
  56.     /**
  57.      * @Gedmo\Versioned
  58.      */
  59.     #[ORM\Column(name'thumbnail'type'string'length255nullabletrue)]
  60.     private ?string $thumbnail null;
  61.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'news')]
  62.     #[ORM\JoinColumn(nullablefalse)]
  63.     private ?\App\Entity\User $updatedBy null;
  64.     #[ORM\Column(type'string'length255nullabletrue)]
  65.     private $cta_text;
  66.     #[ORM\Column(type'string'length255nullabletrue)]
  67.     private $cta_link;
  68.     #[ORM\Column(type'boolean')]
  69.     private $featuredOnNewsPage false;
  70.     #[ORM\Column(type'boolean')]
  71.     private $featuredInWisdomComponent false;
  72.     /**
  73.      * Override slug from LinkTrait to disable auto-update.
  74.      * Slug will only be auto-generated on create, but can be manually set.
  75.      *
  76.      * @Gedmo\Translatable
  77.      *
  78.      * @Gedmo\Versioned
  79.      *
  80.      * @Gedmo\Slug(fields={"title"}, separator="-", updatable=false)
  81.      */
  82.     #[ORM\Column(length255uniquetrue)]
  83.     private ?string $slug null;
  84.     /**
  85.      * Get id.
  86.      *
  87.      * @return int
  88.      */
  89.     public function getId()
  90.     {
  91.         return $this->id;
  92.     }
  93.     /**
  94.      * Set excerpt.
  95.      *
  96.      * @param string $excerpt
  97.      *
  98.      * @return News
  99.      */
  100.     public function setExcerpt($excerpt)
  101.     {
  102.         $this->excerpt $excerpt;
  103.         return $this;
  104.     }
  105.     /**
  106.      * Get excerpt.
  107.      *
  108.      * @return string
  109.      */
  110.     public function getExcerpt()
  111.     {
  112.         return $this->excerpt;
  113.     }
  114.     /**
  115.      * Set publishDate.
  116.      *
  117.      * @param \DateTime|\DateTimeImmutable $publishDate
  118.      *
  119.      * @return News
  120.      */
  121.     public function setPublishDate(\DateTimeInterface $publishDate)
  122.     {
  123.         $this->publishDate $publishDate;
  124.         return $this;
  125.     }
  126.     /**
  127.      * Get publishDate.
  128.      *
  129.      * @return \DateTime
  130.      */
  131.     public function getPublishDate()
  132.     {
  133.         return $this->publishDate;
  134.     }
  135.     /**
  136.      * Set thumbnail.
  137.      *
  138.      * @param string $thumbnail
  139.      *
  140.      * @return News
  141.      */
  142.     public function setThumbnail($thumbnail)
  143.     {
  144.         $this->thumbnail $thumbnail;
  145.         return $this;
  146.     }
  147.     /**
  148.      * Get thumbnail.
  149.      *
  150.      * @return string
  151.      */
  152.     public function getThumbnail()
  153.     {
  154.         return $this->thumbnail;
  155.     }
  156.     // REQUIRED BY THE META LINKS TRAIT
  157.     public function getLinkedPageId(): int
  158.     {
  159.         return 3;
  160.     }
  161.     public function getUpdatedBy(): ?User
  162.     {
  163.         return $this->updatedBy;
  164.     }
  165.     public function setUpdatedBy(?User $updatedBy): self
  166.     {
  167.         $this->updatedBy $updatedBy;
  168.         return $this;
  169.     }
  170.     public function getCtaText(): ?string
  171.     {
  172.         return $this->cta_text;
  173.     }
  174.     public function setCtaText(?string $cta_text): self
  175.     {
  176.         $this->cta_text $cta_text;
  177.         return $this;
  178.     }
  179.     public function getCtaLink(): ?string
  180.     {
  181.         return $this->cta_link;
  182.     }
  183.     public function setCtaLink(?string $cta_link): self
  184.     {
  185.         $this->cta_link $cta_link;
  186.         return $this;
  187.     }
  188.     public function getFeaturedOnNewsPage(): ?bool
  189.     {
  190.         return $this->featuredOnNewsPage;
  191.     }
  192.     public function setFeaturedOnNewsPage(bool $featuredOnNewsPage): self
  193.     {
  194.         $this->featuredOnNewsPage $featuredOnNewsPage;
  195.         return $this;
  196.     }
  197.     public function getFeaturedInWisdomComponent(): ?bool
  198.     {
  199.         return $this->featuredInWisdomComponent;
  200.     }
  201.     public function setFeaturedInWisdomComponent(bool $featuredInWisdomComponent): self
  202.     {
  203.         $this->featuredInWisdomComponent $featuredInWisdomComponent;
  204.         return $this;
  205.     }
  206.     /**
  207.      * Override setSlug from LinkTrait to allow manual setting.
  208.      * If empty string is provided, set to null to allow auto-generation on create.
  209.      */
  210.     public function setSlug(?string $slug): void
  211.     {
  212.         // Convert empty string to null so Gedmo can auto-generate on create
  213.         $this->slug = ($slug === '' || $slug === null) ? null $slug;
  214.     }
  215.     public function getSitemapRouteParams(): array
  216.     {
  217.         return ['slug' => $this->getSlug()];
  218.     }
  219.     public function isIncludedInSitemap(): bool
  220.     {
  221.         $now = new \DateTime();
  222.         return $this->isActive() &&
  223.             ! $this->isDeleted() &&
  224.             $this->getPublishDate() < $now
  225.         ;
  226.     }
  227. }