src/Entity/Link.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  6. use App\Repository\LinkRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\Entity\LinkType;
  9. #[ApiResource]
  10. #[ApiFilter(SearchFilter::class, properties: ['linkType' => 'exact'])]
  11. #[ORM\Entity(repositoryClassLinkRepository::class)]
  12. class Link implements \Stringable
  13. {
  14.    #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(type'integer')]
  17.     private $id;
  18.     #[ORM\Column(type'string'length255)]
  19.     private $title;
  20.     #[ORM\Column(type'string'length255)]
  21.     private $absoluteUrl;
  22.     #[ORM\Column(type'string'length255)]
  23.     private $originEntity="#";
  24.     #[ORM\ManyToOne(targetEntityLinkType::class, inversedBy'links'cascade: ['persist'])]
  25.     private $linkType;
  26.     public function __toString(): string
  27.     {
  28.         return (string) $this->title;
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     /**
  35.      * Get the value of title
  36.      */ 
  37.     public function getTitle()
  38.     {
  39.         return $this->title;
  40.     }
  41.     /**
  42.      * Set the value of title
  43.      *
  44.      * @return  self
  45.      */ 
  46.     public function setTitle($title)
  47.     {
  48.         $this->title $title;
  49.         return $this;
  50.     }
  51.     /**
  52.      * Get the value of absoluteUrl
  53.      */ 
  54.     public function getAbsoluteUrl()
  55.     {
  56.         return $this->absoluteUrl;
  57.     }
  58.     /**
  59.      * Set the value of absoluteUrl
  60.      *
  61.      * @return  self
  62.      */ 
  63.     public function setAbsoluteUrl($absoluteUrl)
  64.     {
  65.         $this->absoluteUrl $absoluteUrl;
  66.         return $this;
  67.     }
  68.     /**
  69.      * Get the value of originEntity
  70.      */ 
  71.     public function getOriginEntity()
  72.     {
  73.         return $this->originEntity;
  74.     }
  75.     /**
  76.      * Set the value of originEntity
  77.      *
  78.      * @return  self
  79.      */ 
  80.     public function setOriginEntity($originEntity)
  81.     {
  82.         $this->originEntity $originEntity;
  83.         return $this;
  84.     }
  85.     /**
  86.      * Get the value of linkType
  87.      */ 
  88.     public function getLinkType()
  89.     {
  90.         return $this->linkType;
  91.     }
  92.     /**
  93.      * Set the value of linkType
  94.      *
  95.      * @return  self
  96.      */ 
  97.     public function setLinkType($linkType)
  98.     {
  99.         $this->linkType $linkType;
  100.         return $this;
  101.     }
  102. }