vendor/perfectneeds/seo-multi-lang-bundle/Entity/SeoBaseRoute.php line 18

Open in your IDE?
  1. <?php
  2. namespace PN\SeoBundle\Entity;
  3. use PN\ServiceBundle\Model\DateTimeTrait;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8. * SeoBaseRoute
  9. *
  10. * @ORM\HasLifecycleCallbacks
  11. * @ORM\Table("seo_base_route")
  12. * @ORM\Entity(repositoryClass="PN\SeoBundle\Repository\SeoBaseRouteRepository")
  13. * @UniqueEntity("entityName",message="This entity name is used before.")
  14. */
  15. class SeoBaseRoute {
  16. use DateTimeTrait;
  17. /**
  18. * @var integer
  19. *
  20. * @ORM\Column(name="id", type="integer")
  21. * @ORM\Id
  22. * @ORM\GeneratedValue(strategy="AUTO")
  23. */
  24. protected $id;
  25. /**
  26. * @var string
  27. *
  28. * @Assert\NotBlank()
  29. * @ORM\Column(name="entity_name", type="string", unique=true)
  30. */
  31. protected $entityName;
  32. /**
  33. * @var string
  34. * @Assert\NotBlank()
  35. * @ORM\Column(name="base_route", type="string")
  36. */
  37. protected $baseRoute;
  38. /**
  39. * Now we tell doctrine that before we persist or update we call the updatedTimestamps() function.
  40. *
  41. * @ORM\PrePersist
  42. * @ORM\PreUpdate
  43. */
  44. public function updatedTimestamps() {
  45. $this->setModified(new \DateTime(date('Y-m-d H:i:s')));
  46. if ($this->getCreated() == null) {
  47. $this->setCreated(new \DateTime(date('Y-m-d H:i:s')));
  48. }
  49. }
  50. /**
  51. * Get id
  52. *
  53. * @return integer
  54. */
  55. public function getId() {
  56. return $this->id;
  57. }
  58. /**
  59. * Set entityName
  60. *
  61. * @param string $entityName
  62. *
  63. * @return SeoBaseRoute
  64. */
  65. public function setEntityName($entityName) {
  66. $this->entityName = $entityName;
  67. return $this;
  68. }
  69. /**
  70. * Get entityName
  71. *
  72. * @return string
  73. */
  74. public function getEntityName() {
  75. return $this->entityName;
  76. }
  77. /**
  78. * Set baseRoute
  79. *
  80. * @param string $baseRoute
  81. *
  82. * @return SeoBaseRoute
  83. */
  84. public function setBaseRoute($baseRoute) {
  85. $this->baseRoute = rtrim($baseRoute, "/");
  86. return $this;
  87. }
  88. /**
  89. * Get baseRoute
  90. *
  91. * @return string
  92. */
  93. public function getBaseRoute() {
  94. return $this->baseRoute;
  95. }
  96. }