Article.php 1.3 KB

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