|
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\Doctrine\Orm\Filter\SearchFilter; |
|
10
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
11
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
12
|
|
|
use DateTimeInterface; |
|
13
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
14
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
15
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
16
|
|
|
|
|
17
|
|
|
#[ApiResource( |
|
18
|
|
|
normalizationContext: ['groups' => ['third_party_exchange:read']], |
|
19
|
|
|
denormalizationContext: ['groups' => ['third_party_exchange:write']], |
|
20
|
|
|
paginationEnabled: false |
|
21
|
|
|
)] |
|
22
|
|
|
#[ApiFilter(SearchFilter::class, properties: ['thirdParty' => 'exact'])] |
|
23
|
|
|
#[ORM\Table(name: 'third_party_data_exchange')] |
|
24
|
|
|
#[ORM\Entity] |
|
25
|
|
|
class ThirdPartyDataExchange |
|
26
|
|
|
{ |
|
27
|
|
|
#[Groups(['third_party_exchange:read'])] |
|
28
|
|
|
#[ORM\Id] |
|
29
|
|
|
#[ORM\GeneratedValue] |
|
30
|
|
|
#[ORM\Column(type: 'integer')] |
|
31
|
|
|
protected ?int $id = null; |
|
32
|
|
|
|
|
33
|
|
|
#[Groups(['third_party_exchange:read', 'third_party_exchange:write'])] |
|
34
|
|
|
#[ORM\ManyToOne(targetEntity: ThirdParty::class)] |
|
35
|
|
|
#[ORM\JoinColumn(name: 'third_party_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
36
|
|
|
protected ThirdParty $thirdParty; |
|
37
|
|
|
|
|
38
|
|
|
#[Groups(['third_party_exchange:read', 'third_party_exchange:write'])] |
|
39
|
|
|
#[Assert\NotBlank] |
|
40
|
|
|
#[ORM\Column(type: 'datetime')] |
|
41
|
|
|
protected DateTimeInterface $sentAt; |
|
42
|
|
|
|
|
43
|
|
|
#[Groups(['third_party_exchange:read', 'third_party_exchange:write'])] |
|
44
|
|
|
#[ORM\Column(type: 'text', nullable: true)] |
|
45
|
|
|
protected ?string $description = null; |
|
46
|
|
|
|
|
47
|
|
|
#[Groups(['third_party_exchange:read', 'third_party_exchange:write'])] |
|
48
|
|
|
#[ORM\Column(type: 'boolean')] |
|
49
|
|
|
protected bool $allUsers = false; |
|
50
|
|
|
|
|
51
|
|
|
public function getId(): ?int |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->id; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getThirdParty(): ThirdParty |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->thirdParty; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function setThirdParty(ThirdParty $thirdParty): static |
|
62
|
|
|
{ |
|
63
|
|
|
$this->thirdParty = $thirdParty; |
|
64
|
|
|
|
|
65
|
|
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function getSentAt(): DateTimeInterface |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->sentAt; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function setSentAt(DateTimeInterface $sentAt): static |
|
74
|
|
|
{ |
|
75
|
|
|
$this->sentAt = $sentAt; |
|
76
|
|
|
|
|
77
|
|
|
return $this; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function getDescription(): ?string |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->description; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function setDescription(?string $description): static |
|
86
|
|
|
{ |
|
87
|
|
|
$this->description = $description; |
|
88
|
|
|
|
|
89
|
|
|
return $this; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function isAllUsers(): bool |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->allUsers; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function setAllUsers(bool $allUsers): static |
|
98
|
|
|
{ |
|
99
|
|
|
$this->allUsers = $allUsers; |
|
100
|
|
|
|
|
101
|
|
|
return $this; |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|