Completed
Push — master ( db9c88...be5baf )
by Julito
14:58
created

Illustration::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 licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Entity;
6
7
use ApiPlatform\Core\Annotation\ApiResource;
8
use Chamilo\CourseBundle\Traits\PersonalResourceTrait;
9
use Doctrine\ORM\Mapping as ORM;
10
use Gedmo\Timestampable\Traits\TimestampableEntity;
11
use Symfony\Component\Serializer\Annotation\Groups;
12
13
/**
14
 * Illustration.
15
 *
16
 * @ApiResource(
17
 *      normalizationContext={"groups"={"illustration:read"}}
18
 * )
19
 * @ORM\Table(name="illustration")
20
 * @ORM\Entity
21
 */
22
class Illustration extends AbstractResource implements ResourceInterface
23
{
24
    use PersonalResourceTrait;
25
    use TimestampableEntity;
26
27
    /**
28
     * @var int
29
     *
30
     * @ORM\Column(name="id", type="integer")
31
     * @ORM\Id
32
     * @ORM\GeneratedValue(strategy="AUTO")
33
     */
34
    protected $id;
35
36
    /**
37
     * @var string
38
     * @Groups({"illustration:read"})
39
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
40
     */
41
    protected $name;
42
43
    /**
44
     * Illustration constructor.
45
     */
46
    public function __construct()
47
    {
48
        $this->name = 'illustration';
49
    }
50
51
    public function __toString(): string
52
    {
53
        return $this->getName();
54
    }
55
56
    public function getId(): int
57
    {
58
        return $this->id;
59
    }
60
61
    public function setId(int $id): self
62
    {
63
        $this->id = $id;
64
65
        return $this;
66
    }
67
68
    public function getName(): string
69
    {
70
        return (string) $this->name;
71
    }
72
73
    public function setName(string $name): self
74
    {
75
        $this->name = $name;
76
77
        return $this;
78
    }
79
80
    public function getResourceIdentifier(): int
81
    {
82
        return $this->getId();
83
    }
84
85
    public function getResourceName(): string
86
    {
87
        return $this->getName();
88
    }
89
90
    public function setResourceName(string $name): self
91
    {
92
        return $this->setName($name);
93
    }
94
}
95