Passed
Push — master ( fc8817...f91339 )
by Angel Fernando Quiroz
10:10 queued 10s
created

TopLinkRelTool::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/* For license terms, see /license.txt */
4
5
namespace Chamilo\PluginBundle\TopLinks\Entity;
6
7
use Chamilo\CourseBundle\Entity\CTool;
8
use Chamilo\PluginBundle\TopLinks\Entity\Repository\TopLinkRelToolRepository;
9
use Doctrine\ORM\Mapping as ORM;
10
11
#[ORM\Table(name: 'toplinks_link_rel_tool')]
12
#[ORM\Entity(repositoryClass: TopLinkRelToolRepository::class)]
13
class TopLinkRelTool
14
{
15
    #[ORM\Column(name: 'id', type: 'integer')]
16
    #[ORM\Id]
17
    #[ORM\GeneratedValue]
18
    private ?int $id;
19
    #[ORM\ManyToOne(targetEntity: TopLink::class, inversedBy: 'tools')]
20
    #[ORM\JoinColumn(name: 'link_id', referencedColumnName: 'id')]
21
    private ?TopLink $link;
22
23
    #[ORM\OneToOne(targetEntity: CTool::class, cascade: ['persist', 'remove'])]
24
    #[ORM\JoinColumn(name: 'tool_id', referencedColumnName: 'iid', nullable: true, onDelete: 'CASCADE')]
25
    private ?CTool $tool;
26
27
    public function getId(): ?int
28
    {
29
        return $this->id;
30
    }
31
32
    public function setId(int $id): TopLinkRelTool
33
    {
34
        $this->id = $id;
35
36
        return $this;
37
    }
38
39
    public function getLink(): ?TopLink
40
    {
41
        return $this->link;
42
    }
43
44
    public function setLink(TopLink $link): static
45
    {
46
        $this->link = $link;
47
48
        return $this;
49
    }
50
51
    public function getTool(): CTool
52
    {
53
        return $this->tool;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->tool could return the type null which is incompatible with the type-hinted return Chamilo\CourseBundle\Entity\CTool. Consider adding an additional type-check to rule them out.
Loading history...
54
    }
55
56
    public function setTool(CTool $tool): static
57
    {
58
        $this->tool = $tool;
59
60
        return $this;
61
    }
62
}
63