1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Entity; |
8
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiResource; |
10
|
|
|
use Doctrine\ORM\Mapping as ORM; |
11
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
12
|
|
|
|
13
|
|
|
#[ApiResource( |
14
|
|
|
normalizationContext: ['groups' => ['third_party_user:read']], |
15
|
|
|
denormalizationContext: ['groups' => ['third_party_user:write']], |
16
|
|
|
paginationEnabled: false |
17
|
|
|
)] |
18
|
|
|
#[ORM\Table(name: 'third_party_data_exchange_user')] |
19
|
|
|
#[ORM\Entity] |
20
|
|
|
class ThirdPartyDataExchangeUser |
21
|
|
|
{ |
22
|
|
|
#[Groups(['third_party_user:read'])] |
23
|
|
|
#[ORM\Id] |
24
|
|
|
#[ORM\GeneratedValue] |
25
|
|
|
#[ORM\Column(type: 'integer')] |
26
|
|
|
protected ?int $id = null; |
27
|
|
|
|
28
|
|
|
#[Groups(['third_party_user:read', 'third_party_user:write'])] |
29
|
|
|
#[ORM\ManyToOne(targetEntity: ThirdPartyDataExchange::class)] |
30
|
|
|
#[ORM\JoinColumn(name: 'third_party_data_exchange_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
31
|
|
|
protected ThirdPartyDataExchange $dataExchange; |
32
|
|
|
|
33
|
|
|
#[Groups(['third_party_user:read', 'third_party_user:write'])] |
34
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
35
|
|
|
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
36
|
|
|
protected User $user; |
37
|
|
|
|
38
|
|
|
public function getId(): ?int |
39
|
|
|
{ |
40
|
|
|
return $this->id; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function getDataExchange(): ThirdPartyDataExchange |
44
|
|
|
{ |
45
|
|
|
return $this->dataExchange; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function setDataExchange(ThirdPartyDataExchange $dataExchange): static |
49
|
|
|
{ |
50
|
|
|
$this->dataExchange = $dataExchange; |
51
|
|
|
|
52
|
|
|
return $this; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function getUser(): User |
56
|
|
|
{ |
57
|
|
|
return $this->user; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function setUser(User $user): static |
61
|
|
|
{ |
62
|
|
|
$this->user = $user; |
63
|
|
|
|
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|