3 namespace Wallabag\ApiBundle\Entity
;
5 use Doctrine\ORM\Mapping
as ORM
;
6 use FOS\OAuthServerBundle\Entity\Client
as BaseClient
;
7 use JMS\Serializer\Annotation\Groups
;
8 use JMS\Serializer\Annotation\SerializedName
;
9 use JMS\Serializer\Annotation\VirtualProperty
;
10 use Wallabag\UserBundle\Entity\User
;
13 * @ORM\Table("oauth2_clients")
16 class Client
extends BaseClient
20 * @ORM\Column(type="integer")
21 * @ORM\GeneratedValue(strategy="AUTO")
28 * @ORM\Column(name="name", type="text", nullable=false)
30 * @Groups({"user_api_with_client"})
35 * @ORM\OneToMany(targetEntity="RefreshToken", mappedBy="client", cascade={"remove"})
37 protected $refreshTokens;
40 * @ORM\OneToMany(targetEntity="AccessToken", mappedBy="client", cascade={"remove"})
42 protected $accessTokens;
47 * @SerializedName("client_secret")
48 * @Groups({"user_api_with_client"})
53 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients")
57 public function __construct(User
$user)
59 parent
::__construct();
68 public function getName()
80 public function setName($name)
90 public function getUser()
97 * @SerializedName("client_id")
98 * @Groups({"user_api_with_client"})
100 public function getClientId()
102 return $this->getId() . '_' . $this->getRandomId();