src/Submarine/PagesBundle/Entity/TitleUrlRelations.php line 18

Open in your IDE?
  1. <?php
  2. namespace Submarine\PagesBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Submarine\CoreBundle\Entity\SubmarineEntityInterface;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * Class TitleUrlRelations
  9.  * @package Submarine\PagesBundle
  10.  *
  11.  * @ORM\Entity
  12.  * @ORM\Table(name="submarine_title_url_relations")
  13.  * @ORM\HasLifecycleCallbacks()
  14.  */
  15. class TitleUrlRelations implements SubmarineEntityInterface
  16. {
  17.     /**
  18.      * ID
  19.      * @var int
  20.      *
  21.      * @ORM\Id()
  22.      * @ORM\Column(name="id", type="integer", nullable=false, unique=true)
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @var string|null
  28.      *
  29.      * @ORM\Column(name="title", type="string", nullable=true)
  30.      * @Assert\NotBlank()
  31.      */
  32.     private $title;
  33.     /**
  34.      * URL
  35.      * @var string|null
  36.      *
  37.      * @ORM\Column(name="url", type="string", nullable=true)
  38.      */
  39.     private $url;
  40.     /**
  41.      * Страница каталога
  42.      *
  43.      * @var Page
  44.      * @ORM\ManyToOne(targetEntity="Submarine\PagesBundle\Entity\Page", inversedBy="titleUrlRelations")
  45.      * @ORM\JoinColumn(name="page_id", referencedColumnName="id")
  46.      */
  47.     private $page;
  48.     /**
  49.      * @return int
  50.      */
  51.     public function getId(): int
  52.     {
  53.         return $this->id;
  54.     }
  55.     /**
  56.      * @param int $id
  57.      */
  58.     public function setId(int $id): void
  59.     {
  60.         $this->id $id;
  61.     }
  62.     /**
  63.      * @return string|null
  64.      */
  65.     public function getTitle(): ?string
  66.     {
  67.         return $this->title;
  68.     }
  69.     /**
  70.      * @param string|null $title
  71.      */
  72.     public function setTitle(?string $title): void
  73.     {
  74.         $this->title $title;
  75.     }
  76.     /**
  77.      * @return string|null
  78.      */
  79.     public function getUrl(): ?string
  80.     {
  81.         return $this->url;
  82.     }
  83.     /**
  84.      * @param string|null $url
  85.      */
  86.     public function setUrl(?string $url): void
  87.     {
  88.         $this->url $url;
  89.     }
  90.     /**
  91.      * @return Page
  92.      */
  93.     public function getPage()
  94.     {
  95.         return $this->page;
  96.     }
  97.     /**
  98.      * @param Page $page
  99.      */
  100.     public function setPage(Page $page): void
  101.     {
  102.         $this->page $page;
  103.     }
  104.     /**
  105.      * Имя сущности
  106.      * @return string
  107.      */
  108.     public static function entityName(): string
  109.     {
  110.         return __CLASS__;
  111.     }
  112. }