vendor/sulu/sulu/src/Sulu/Bundle/ContactBundle/Entity/ContactTitle.php line 19

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of Sulu.
  4. *
  5. * (c) Sulu GmbH
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace Sulu\Bundle\ContactBundle\Entity;
  11. use JMS\Serializer\Annotation\Groups;
  12. /**
  13. * ContactTitle.
  14. */
  15. class ContactTitle implements \JsonSerializable
  16. {
  17. public const RESOURCE_KEY = 'contact_titles';
  18. /**
  19. * @var string
  20. */
  21. #[Groups(['fullContact', 'partialContact'])]
  22. private $title;
  23. /**
  24. * @var int
  25. */
  26. #[Groups(['fullContact', 'partialContact'])]
  27. private $id;
  28. /**
  29. * Set title.
  30. *
  31. * @param string $title
  32. *
  33. * @return ContactTitle
  34. */
  35. public function setTitle($title)
  36. {
  37. $this->title = $title;
  38. return $this;
  39. }
  40. /**
  41. * Get title.
  42. *
  43. * @return string
  44. */
  45. public function getTitle()
  46. {
  47. return $this->title;
  48. }
  49. /**
  50. * Get id.
  51. *
  52. * @return int
  53. */
  54. public function getId()
  55. {
  56. return $this->id;
  57. }
  58. /**
  59. * (PHP 5 &gt;= 5.4.0)<br/>
  60. * Specify data which should be serialized to JSON.
  61. *
  62. * @see http://php.net/manual/en/jsonserializable.jsonserialize.php
  63. *
  64. * @return mixed data which can be serialized by <b>json_encode</b>,
  65. * which is a value of any type other than a resource
  66. */
  67. #[\ReturnTypeWillChange]
  68. public function jsonSerialize()
  69. {
  70. return [
  71. 'id' => $this->getId(),
  72. 'title' => $this->getTitle(),
  73. ];
  74. }
  75. /**
  76. * Return the string representation of this title.
  77. *
  78. * @return string
  79. */
  80. public function __toString()
  81. {
  82. return (string) $this->getTitle();
  83. }
  84. }