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

  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.  * Position.
  14.  */
  15. class Position implements \JsonSerializable
  16. {
  17.     public const RESOURCE_KEY 'contact_positions';
  18.     /**
  19.      * @var string
  20.      *
  21.      * @Groups({"fullContact", "partialContact"})
  22.      */
  23.     private $position;
  24.     /**
  25.      * @var int
  26.      *
  27.      * @Groups({"fullContact", "partialContact"})
  28.      */
  29.     private $id;
  30.     /**
  31.      * Set position.
  32.      *
  33.      * @param string $position
  34.      *
  35.      * @return Position
  36.      */
  37.     public function setPosition($position)
  38.     {
  39.         $this->position $position;
  40.         return $this;
  41.     }
  42.     /**
  43.      * Get position.
  44.      *
  45.      * @return string
  46.      */
  47.     public function getPosition()
  48.     {
  49.         return $this->position;
  50.     }
  51.     /**
  52.      * Get id.
  53.      *
  54.      * @return int
  55.      */
  56.     public function getId()
  57.     {
  58.         return $this->id;
  59.     }
  60.     /**
  61.      * (PHP 5 &gt;= 5.4.0)<br/>
  62.      * Specify data which should be serialized to JSON.
  63.      *
  64.      * @see http://php.net/manual/en/jsonserializable.jsonserialize.php
  65.      *
  66.      * @return mixed data which can be serialized by <b>json_encode</b>,
  67.      *               which is a value of any type other than a resource
  68.      */
  69.     #[\ReturnTypeWillChange]
  70.     public function jsonSerialize()
  71.     {
  72.         return [
  73.             'id' => $this->getId(),
  74.             'position' => $this->getPosition(),
  75.         ];
  76.     }
  77. }