Passed
Push — master ( 8f17a5...faab0f )
by Julito
09:35
created

CShortcut::setShortCutNode()   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
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Entity;
6
7
use APY\DataGridBundle\Grid\Mapping as GRID;
8
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
9
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
10
use Doctrine\ORM\Mapping as ORM;
11
use Symfony\Component\Validator\Constraints as Assert;
12
13
/**
14
 * @ORM\Table(name="c_shortcut")
15
 * @ORM\Entity
16
 * @GRID\Source(columns="id, name, resourceNode.createdAt", filterable=false, groups={"resource"})
17
 */
18
class CShortcut extends AbstractResource implements ResourceInterface
19
{
20
    /**
21
     * @var int
22
     *
23
     * @ORM\Column(name="id", type="integer")
24
     * @ORM\Id
25
     * @ORM\GeneratedValue
26
     */
27
    protected $id;
28
29
    /**
30
     * @Assert\NotBlank
31
     *
32
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
33
     */
34
    protected $name;
35
36
    /**
37
     * @ORM\OneToOne(
38
     *     targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", mappedBy="resource", cascade={"remove"}, orphanRemoval=true
39
     * )
40
     * @ORM\JoinColumn(name="shortcut_node_id", referencedColumnName="id", onDelete="CASCADE")
41
     */
42
    public $shortCutNode;
43
44
    public function __toString(): string
45
    {
46
        return $this->getName();
47
    }
48
49
    public function getName(): string
50
    {
51
        return $this->name;
52
    }
53
54
    public function setName(string $name): self
55
    {
56
        $this->name = $name;
57
58
        return $this;
59
    }
60
61
    /**
62
     * Resource identifier.
63
     */
64
    public function getResourceIdentifier(): int
65
    {
66
        return $this->id;
67
    }
68
69
    public function getResourceName(): string
70
    {
71
        return $this->getName();
72
    }
73
74
    /**
75
     * @return mixed
76
     */
77
    public function getShortCutNode()
78
    {
79
        return $this->shortCutNode;
80
    }
81
82
    /**
83
     * @param mixed $shortCutNode
84
     *
85
     * @return CShortcut
86
     */
87
    public function setShortCutNode($shortCutNode)
88
    {
89
        $this->shortCutNode = $shortCutNode;
90
91
        return $this;
92
    }
93
}
94