Article.php 1.5 KB

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