vendor/kunstmaan/seo-bundle/Entity/Seo.php line 24

Open in your IDE?
  1. <?php
  2. namespace Kunstmaan\SeoBundle\Entity;
  3. use Doctrine\ORM\EntityManager;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Kunstmaan\AdminBundle\Entity\AbstractEntity;
  6. use Kunstmaan\MediaBundle\Entity\Media;
  7. use Kunstmaan\SeoBundle\Form\SeoType;
  8. use Kunstmaan\SeoBundle\Repository\SeoRepository;
  9. use Kunstmaan\UtilitiesBundle\Helper\ClassLookup;
  10. /**
  11.  * Seo metadata for entities
  12.  *
  13.  * @ORM\Entity(repositoryClass="Kunstmaan\SeoBundle\Repository\SeoRepository")
  14.  * @ORM\Table(name="kuma_seo", indexes={@ORM\Index(name="idx_seo_lookup", columns={"ref_id", "ref_entity_name"})})
  15.  * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
  16.  */
  17. #[ORM\Entity(repositoryClassSeoRepository::class)]
  18. #[ORM\Table(name'kuma_seo')]
  19. #[ORM\Index(name'idx_seo_lookup'columns: ['ref_id''ref_entity_name'])]
  20. #[ORM\ChangeTrackingPolicy('DEFERRED_EXPLICIT')]
  21. class Seo extends AbstractEntity
  22. {
  23.     /**
  24.      * @var string
  25.      *
  26.      * @ORM\Column(name="meta_title", type="string", nullable=true)
  27.      */
  28.     #[ORM\Column(name'meta_title'type'string'nullabletrue)]
  29.     protected $metaTitle;
  30.     /**
  31.      * @var string
  32.      *
  33.      * @ORM\Column(name="meta_description", type="text", nullable=true)
  34.      */
  35.     #[ORM\Column(name'meta_description'type'text'nullabletrue)]
  36.     protected $metaDescription;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="meta_author", type="string", nullable=true)
  41.      */
  42.     #[ORM\Column(name'meta_author'type'string'nullabletrue)]
  43.     protected $metaAuthor;
  44.     /**
  45.      * @var string
  46.      *
  47.      * @ORM\Column(name="meta_robots", type="string", nullable=true)
  48.      */
  49.     #[ORM\Column(name'meta_robots'type'string'nullabletrue)]
  50.     protected $metaRobots;
  51.     /**
  52.      * @var string
  53.      *
  54.      * @ORM\Column(name="og_type", type="string", nullable=true)
  55.      */
  56.     #[ORM\Column(name'og_type'type'string'nullabletrue)]
  57.     protected $ogType;
  58.     /**
  59.      * @var string
  60.      *
  61.      * @ORM\Column(name="og_title", type="string", nullable=true)
  62.      */
  63.     #[ORM\Column(name'og_title'type'string'nullabletrue)]
  64.     protected $ogTitle;
  65.     /**
  66.      * @var string
  67.      *
  68.      * @ORM\Column(name="og_description", type="text", nullable=true)
  69.      */
  70.     #[ORM\Column(name'og_description'type'text'nullabletrue)]
  71.     protected $ogDescription;
  72.     /**
  73.      * @var Media
  74.      *
  75.      * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media")
  76.      * @ORM\JoinColumn(name="og_image_id", referencedColumnName="id")
  77.      */
  78.     #[ORM\ManyToOne(targetEntityMedia::class)]
  79.     #[ORM\JoinColumn(name'og_image_id'referencedColumnName'id')]
  80.     protected $ogImage;
  81.     /**
  82.      * @var string
  83.      *
  84.      * @ORM\Column(name="extra_metadata", type="text", nullable=true)
  85.      */
  86.     #[ORM\Column(name'extra_metadata'type'text'nullabletrue)]
  87.     protected $extraMetadata;
  88.     /**
  89.      * @var int
  90.      *
  91.      * @ORM\Column(type="bigint", name="ref_id")
  92.      */
  93.     #[ORM\Column(name'ref_id'type'bigint')]
  94.     protected $refId;
  95.     /**
  96.      * @var string
  97.      *
  98.      * @ORM\Column(type="string", name="ref_entity_name")
  99.      */
  100.     #[ORM\Column(name'ref_entity_name'type'string')]
  101.     protected $refEntityName;
  102.     /**
  103.      * @ORM\Column(type="string", nullable=true, name="og_url")
  104.      */
  105.     #[ORM\Column(name'og_url'type'string'nullabletrue)]
  106.     protected $ogUrl;
  107.     /**
  108.      * @ORM\Column(type="string", length=100, nullable=true, name="og_article_author")
  109.      */
  110.     #[ORM\Column(name'og_article_author'type'string'length100nullabletrue)]
  111.     protected $ogArticleAuthor;
  112.     /**
  113.      * @ORM\Column(type="string", length=100, nullable=true, name="og_article_publisher")
  114.      */
  115.     #[ORM\Column(name'og_article_publisher'type'string'length100nullabletrue)]
  116.     protected $ogArticlePublisher;
  117.     /**
  118.      * @ORM\Column(type="string", length=100, nullable=true, name="og_article_section")
  119.      */
  120.     #[ORM\Column(name'og_article_section'type'string'length100nullabletrue)]
  121.     protected $ogArticleSection;
  122.     /**
  123.      * @var string
  124.      *
  125.      * @ORM\Column(name="twitter_title", type="string", length=255, nullable=true)
  126.      */
  127.     #[ORM\Column(name'twitter_title'type'string'length255nullabletrue)]
  128.     protected $twitterTitle;
  129.     /**
  130.      * @var string
  131.      *
  132.      * @ORM\Column(name="twitter_description", type="text", nullable=true)
  133.      */
  134.     #[ORM\Column(name'twitter_description'type'text'nullabletrue)]
  135.     protected $twitterDescription;
  136.     /**
  137.      * @var string
  138.      *
  139.      * @ORM\Column(name="twitter_site", type="string", length=255, nullable=true)
  140.      */
  141.     #[ORM\Column(name'twitter_site'type'string'length255nullabletrue)]
  142.     protected $twitterSite;
  143.     /**
  144.      * @var string
  145.      *
  146.      * @ORM\Column(name="twitter_creator", type="string", length=255, nullable=true)
  147.      */
  148.     #[ORM\Column(name'twitter_creator'type'string'length255nullabletrue)]
  149.     protected $twitterCreator;
  150.     /**
  151.      * @var Media
  152.      *
  153.      * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media")
  154.      * @ORM\JoinColumn(name="twitter_image_id", referencedColumnName="id")
  155.      */
  156.     #[ORM\ManyToOne(targetEntityMedia::class)]
  157.     #[ORM\JoinColumn(name'twitter_image_id'referencedColumnName'id')]
  158.     protected $twitterImage;
  159.     /**
  160.      * @param string $url
  161.      *
  162.      * @return Seo
  163.      */
  164.     public function setOgUrl($url)
  165.     {
  166.         $this->ogUrl $url;
  167.         return $this;
  168.     }
  169.     /**
  170.      * @return string
  171.      */
  172.     public function getOgUrl()
  173.     {
  174.         return $this->ogUrl;
  175.     }
  176.     /**
  177.      * @return string
  178.      */
  179.     public function getMetaTitle()
  180.     {
  181.         return $this->metaTitle;
  182.     }
  183.     /**
  184.      * @param string $title
  185.      *
  186.      * @return string
  187.      */
  188.     public function setMetaTitle($title)
  189.     {
  190.         $this->metaTitle $title;
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return string
  195.      */
  196.     public function getMetaAuthor()
  197.     {
  198.         return $this->metaAuthor;
  199.     }
  200.     /**
  201.      * @param string $meta
  202.      *
  203.      * @return Seo
  204.      */
  205.     public function setMetaAuthor($meta)
  206.     {
  207.         $this->metaAuthor $meta;
  208.         return $this;
  209.     }
  210.     /**
  211.      * @return string
  212.      */
  213.     public function getMetaDescription()
  214.     {
  215.         return $this->metaDescription;
  216.     }
  217.     /**
  218.      * @param string $meta
  219.      *
  220.      * @return Seo
  221.      */
  222.     public function setMetaDescription($meta)
  223.     {
  224.         $this->metaDescription $meta;
  225.         return $this;
  226.     }
  227.     /**
  228.      * @return string
  229.      */
  230.     public function getMetaRobots()
  231.     {
  232.         return $this->metaRobots;
  233.     }
  234.     /**
  235.      * @param string $meta
  236.      *
  237.      * @return Seo
  238.      */
  239.     public function setMetaRobots($meta)
  240.     {
  241.         $this->metaRobots $meta;
  242.         return $this;
  243.     }
  244.     /**
  245.      * @return string
  246.      */
  247.     public function getExtraMetadata()
  248.     {
  249.         return $this->extraMetadata;
  250.     }
  251.     /**
  252.      * @param string $extraMetadata
  253.      *
  254.      * @return Seo
  255.      */
  256.     public function setExtraMetadata($extraMetadata)
  257.     {
  258.         $this->extraMetadata $extraMetadata;
  259.         return $this;
  260.     }
  261.     /**
  262.      * @param string $ogDescription
  263.      *
  264.      * @return Seo
  265.      */
  266.     public function setOgDescription($ogDescription)
  267.     {
  268.         $this->ogDescription $ogDescription;
  269.         return $this;
  270.     }
  271.     public function getOgDescription()
  272.     {
  273.         return $this->ogDescription;
  274.     }
  275.     /**
  276.      * @return Seo
  277.      */
  278.     public function setOgImage(?Media $ogImage null)
  279.     {
  280.         $this->ogImage $ogImage;
  281.         return $this;
  282.     }
  283.     public function getOgImage()
  284.     {
  285.         return $this->ogImage;
  286.     }
  287.     /**
  288.      * @param string $ogTitle
  289.      *
  290.      * @return Seo
  291.      */
  292.     public function setOgTitle($ogTitle)
  293.     {
  294.         $this->ogTitle $ogTitle;
  295.         return $this;
  296.     }
  297.     public function getOgTitle()
  298.     {
  299.         return $this->ogTitle;
  300.     }
  301.     /**
  302.      * @param string $ogType
  303.      *
  304.      * @return Seo
  305.      */
  306.     public function setOgType($ogType)
  307.     {
  308.         $this->ogType $ogType;
  309.         return $this;
  310.     }
  311.     public function getOgType()
  312.     {
  313.         return $this->ogType;
  314.     }
  315.     public function getOgArticleAuthor()
  316.     {
  317.         return $this->ogArticleAuthor;
  318.     }
  319.     public function setOgArticleAuthor($ogArticleAuthor)
  320.     {
  321.         $this->ogArticleAuthor $ogArticleAuthor;
  322.     }
  323.     public function getOgArticlePublisher()
  324.     {
  325.         return $this->ogArticlePublisher;
  326.     }
  327.     public function setOgArticlePublisher($ogArticlePublisher)
  328.     {
  329.         $this->ogArticlePublisher $ogArticlePublisher;
  330.     }
  331.     public function getOgArticleSection()
  332.     {
  333.         return $this->ogArticleSection;
  334.     }
  335.     public function setOgArticleSection($ogArticleSection)
  336.     {
  337.         $this->ogArticleSection $ogArticleSection;
  338.     }
  339.     /**
  340.      * @return string
  341.      */
  342.     public function getTwitterTitle()
  343.     {
  344.         return $this->twitterTitle;
  345.     }
  346.     /**
  347.      * @param string $twitterTitle
  348.      */
  349.     public function setTwitterTitle($twitterTitle)
  350.     {
  351.         $this->twitterTitle $twitterTitle;
  352.     }
  353.     /**
  354.      * @return string
  355.      */
  356.     public function getTwitterDescription()
  357.     {
  358.         return $this->twitterDescription;
  359.     }
  360.     /**
  361.      * @param string $twitterDescription
  362.      */
  363.     public function setTwitterDescription($twitterDescription)
  364.     {
  365.         $this->twitterDescription $twitterDescription;
  366.     }
  367.     /**
  368.      * @return string
  369.      */
  370.     public function getTwitterSite()
  371.     {
  372.         return $this->twitterSite;
  373.     }
  374.     /**
  375.      * @param string $twitterSite
  376.      */
  377.     public function setTwitterSite($twitterSite)
  378.     {
  379.         $this->twitterSite $twitterSite;
  380.     }
  381.     /**
  382.      * @return string
  383.      */
  384.     public function getTwitterCreator()
  385.     {
  386.         return $this->twitterCreator;
  387.     }
  388.     /**
  389.      * @param string $twitterCreator
  390.      */
  391.     public function setTwitterCreator($twitterCreator)
  392.     {
  393.         $this->twitterCreator $twitterCreator;
  394.     }
  395.     /**
  396.      * @return Media
  397.      */
  398.     public function getTwitterImage()
  399.     {
  400.         return $this->twitterImage;
  401.     }
  402.     /**
  403.      * @param Media $twitterImage
  404.      */
  405.     public function setTwitterImage($twitterImage)
  406.     {
  407.         $this->twitterImage $twitterImage;
  408.     }
  409.     /**
  410.      * Get refId
  411.      *
  412.      * @return int
  413.      */
  414.     public function getRefId()
  415.     {
  416.         return $this->refId;
  417.     }
  418.     /**
  419.      * Set refId
  420.      *
  421.      * @param int $refId
  422.      *
  423.      * @return Seo
  424.      */
  425.     protected function setRefId($refId)
  426.     {
  427.         $this->refId $refId;
  428.         return $this;
  429.     }
  430.     /**
  431.      * Set reference entity name
  432.      *
  433.      * @param string $refEntityName
  434.      *
  435.      * @return Seo
  436.      */
  437.     protected function setRefEntityName($refEntityName)
  438.     {
  439.         $this->refEntityName $refEntityName;
  440.         return $this;
  441.     }
  442.     /**
  443.      * Get reference entity name
  444.      *
  445.      * @return string
  446.      */
  447.     public function getRefEntityName()
  448.     {
  449.         return $this->refEntityName;
  450.     }
  451.     /**
  452.      * @return Seo
  453.      */
  454.     public function setRef(AbstractEntity $entity)
  455.     {
  456.         $this->setRefId($entity->getId());
  457.         $this->setRefEntityName(ClassLookup::getClass($entity));
  458.         return $this;
  459.     }
  460.     /**
  461.      * @return AbstractEntity
  462.      */
  463.     public function getRef(EntityManager $em)
  464.     {
  465.         return $em->getRepository($this->getRefEntityName())->find($this->getRefId());
  466.     }
  467.     /**
  468.      * @return string
  469.      */
  470.     public function getDefaultAdminType()
  471.     {
  472.         return SeoType::class;
  473.     }
  474. }