Passed
Push — preprodparkur ( f4828c...eec125 )
by Angel Fernando Quiroz
13:34
created

EventCollectiveTrait::hasInvitation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Traits;
6
7
use Chamilo\CoreBundle\Entity\AgendaEventInvitation;
8
use Doctrine\ORM\Mapping as ORM;
9
10
trait EventCollectiveTrait
11
{
12
    /**
13
     * @var AgendaEventInvitation|null
14
     *
15
     * @ORM\OneToOne(
16
     *     targetEntity="Chamilo\CoreBundle\Entity\AgendaEventInvitation",
17
     *     cascade={"persist", "remove"},
18
     *     orphanRemoval=true
19
     * )
20
     * @ORM\JoinColumn(name="agenda_event_invitation_id", referencedColumnName="id", onDelete="CASCADE")
21
     */
22
    protected $invitation;
23
24
    /**
25
     * @ORM\Column(name="collective", type="boolean", nullable=false)
26
     */
27
    protected $collective = false;
28
29
    public function hasInvitation(): bool
30
    {
31
        return $this->invitation instanceof AgendaEventInvitation;
32
    }
33
34
    public function getInvitation(): ?AgendaEventInvitation
35
    {
36
        return $this->invitation;
37
    }
38
39
    /**
40
     * @return $this
41
     */
42
    public function setInvitation(AgendaEventInvitation $invitation)
43
    {
44
        $this->invitation = $invitation;
45
46
        return $this;
47
    }
48
49
    public function isCollective(): bool
50
    {
51
        return $this->collective;
52
    }
53
54
    /**
55
     * @return $this
56
     */
57
    public function setCollective(bool $collective)
58
    {
59
        $this->collective = $collective;
60
61
        return $this;
62
    }
63
}
64