Artist::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace AudioCoreEntity\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Component\Serializer\Annotation\Groups;
8
use Gedmo\Mapping\Annotation as Gedmo;
9
use Gedmo\Timestampable\Traits\TimestampableEntity;
10
11
/**
12
 * Artist
13
 *
14
 * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="name_idx", columns={"name"})})
15
 * @ORM\Entity
16
 */
17 View Code Duplication
class Artist
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    use TimestampableEntity;
20
21
    /**
22
     * @var integer
23
     *
24
     * @ORM\Column(name="id", type="integer")
25
     * @ORM\Id
26
     * @ORM\GeneratedValue(strategy="AUTO")
27
     */
28
    private $id;
29
30
    /**
31
     * @var string
32
     *
33
     * @ORM\Column(name="name", type="string", length=200, nullable=false)
34
     * @Groups({"artist-read", "media-read"})
35
     */
36
    private $name;
37
    /**
38
     * @ORM\ManyToMany(targetEntity="\AudioCoreEntity\Entity\Media",mappedBy="artists")
39
     * @Groups({"artist-read"})
40
     **/
41
    private $medias;
42
43
    /**
44
     * @var string
45
     * @Gedmo\Slug(fields={"name"}, unique=true)
46
     * @ORM\Column(type="string", length=128, unique=true)
47
     */
48
    protected $slug;
49
50
    /**
51
     * Artist constructor.
52
     * @param null $name
53
     */
54 2
    public function __construct($name = null)
55
    {
56 2
        $this->setName($name);
57 2
        $this->medias = new ArrayCollection();
58 2
    }
59
60
    /**
61
     * Get id
62
     *
63
     * @return integer 
64
     */
65 1
    public function getId()
66
    {
67 1
        return $this->id;
68
    }
69
70
    /**
71
     * @return string
72
     */
73 1
    public function getName()
74
    {
75 1
        return $this->name;
76
    }
77
78
    /**
79
     * @param string $name
80
     * @return $this
81
     */
82 2
    public function setName($name)
83
    {
84 2
        $this->name = $name;
85 2
        return $this;
86
    }
87
88
    /**
89
     * @return mixed
90
     */
91 1
    public function getMedias()
92
    {
93 1
        return $this->medias;
94
    }
95
96
    /**
97
     * @param mixed $medias
98
     * @return Artist
99
     */
100 1
    public function setMedias($medias)
101
    {
102 1
        $this->medias = $medias;
103 1
        return $this;
104
    }
105
106
    /**
107
     * @return string
108
     */
109
    public function getSlug()
110
    {
111
        return $this->slug;
112
    }
113
}
114