1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the TheAlternativeZurich/events project. |
5
|
|
|
* |
6
|
|
|
* (c) Florian Moser <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace App\Entity; |
13
|
|
|
|
14
|
|
|
use App\Entity\Base\BaseEntity; |
15
|
|
|
use App\Entity\Traits\ContactInformationTrait; |
16
|
|
|
use App\Entity\Traits\IdTrait; |
17
|
|
|
use App\Entity\Traits\TimeTrait; |
18
|
|
|
use Doctrine\ORM\Mapping as ORM; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @ORM\Entity() |
22
|
|
|
* @ORM\HasLifecycleCallbacks |
23
|
|
|
*/ |
24
|
|
|
class Attendance extends BaseEntity |
25
|
|
|
{ |
26
|
|
|
use IdTrait; |
27
|
|
|
use TimeTrait; |
28
|
|
|
use ContactInformationTrait; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var Event |
32
|
|
|
* |
33
|
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\Event", inversedBy="attendances") |
34
|
|
|
*/ |
35
|
|
|
private $event; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var Registration |
39
|
|
|
* |
40
|
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\Registration", inversedBy="attendances") |
41
|
|
|
*/ |
42
|
|
|
private $registration; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var \DateTime |
46
|
|
|
* |
47
|
|
|
* @ORM\Column(type="datetime") |
48
|
|
|
*/ |
49
|
|
|
private $joinDate; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var \DateTime|null |
53
|
|
|
* |
54
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
55
|
|
|
*/ |
56
|
|
|
private $leaveDate; |
57
|
|
|
|
58
|
|
|
public static function create(Event $event, Registration $registration) |
59
|
|
|
{ |
60
|
|
|
$attendance = new Attendance(); |
61
|
|
|
$attendance->event = $event; |
62
|
|
|
$attendance->registration = $registration; |
63
|
|
|
$attendance->joinDate = new \DateTime(); |
64
|
|
|
$attendance->fromOtherContactInformation($registration); |
65
|
|
|
|
66
|
|
|
return $attendance; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function toArray(): array |
70
|
|
|
{ |
71
|
|
|
$contactInformationArray = $this->toContactInformationArray(); |
72
|
|
|
$contactInformationArray['join'] = $this->joinDate->format('c'); |
73
|
|
|
$contactInformationArray['leave'] = $this->leaveDate->format('c'); |
|
|
|
|
74
|
|
|
|
75
|
|
|
return $contactInformationArray; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getEvent(): Event |
79
|
|
|
{ |
80
|
|
|
return $this->event; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getRegistration(): Registration |
84
|
|
|
{ |
85
|
|
|
return $this->registration; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getJoinDate(): \DateTime |
89
|
|
|
{ |
90
|
|
|
return $this->joinDate; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getLeaveDate(): ?\DateTime |
94
|
|
|
{ |
95
|
|
|
return $this->leaveDate; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function setLeaveDate(?\DateTime $leaveDate): void |
99
|
|
|
{ |
100
|
|
|
$this->leaveDate = $leaveDate; |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.