ArticleRelativeSlug.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace Sluggable\Fixture\Handler;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity
  7. */
  8. class ArticleRelativeSlug
  9. {
  10. /**
  11. * @ORM\Id
  12. * @ORM\GeneratedValue
  13. * @ORM\Column(type="integer")
  14. */
  15. private $id;
  16. /**
  17. * @ORM\Column(length=64)
  18. */
  19. private $title;
  20. /**
  21. * @Gedmo\Slug(handlers={
  22. * @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\RelativeSlugHandler", options={
  23. * @Gedmo\SlugHandlerOption(name="relationField", value="article"),
  24. * @Gedmo\SlugHandlerOption(name="relationSlugField", value="slug"),
  25. * @Gedmo\SlugHandlerOption(name="separator", value="/")
  26. * })
  27. * }, separator="-", updatable=true, fields={"title"})
  28. * @ORM\Column(name="slug", type="string", length=64, unique=true)
  29. */
  30. private $slug;
  31. /**
  32. * @ORM\ManyToOne(targetEntity="Article")
  33. */
  34. private $article;
  35. public function setArticle(Article $article = null)
  36. {
  37. $this->article = $article;
  38. }
  39. public function getArticle()
  40. {
  41. return $this->article;
  42. }
  43. public function getId()
  44. {
  45. return $this->id;
  46. }
  47. public function setTitle($title)
  48. {
  49. $this->title = $title;
  50. }
  51. public function getTitle()
  52. {
  53. return $this->title;
  54. }
  55. public function getSlug()
  56. {
  57. return $this->slug;
  58. }
  59. }