Completed
Push — master ( 6b5246...8691e9 )
by David
04:53 queued 02:40
created

Product   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 13
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 99
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 6 1
A getDescription() 0 4 1
A setDescription() 0 6 1
A getUrl() 0 4 1
A setUrl() 0 6 1
A getMedias() 0 4 1
A addMedia() 0 9 2
A removeMedia() 0 8 2
1
<?php
2
3
namespace A2lix\AutoFormBundle\Tests\Fixtures\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * @ORM\Entity
9
 */
10
class Product
11
{
12
    /**
13
     * @ORM\Id
14
     * @ORM\Column(type="integer")
15
     * @ORM\GeneratedValue(strategy="AUTO")
16
     */
17
    protected $id;
18
19
    /**
20
     * @ORM\Column(nullable=true)
21
     */
22
    protected $title;
23
24
    /**
25
     * @ORM\Column(type="text", nullable=true)
26
     */
27
    protected $description;
28
29
    /**
30
     * @ORM\Column(nullable=true)
31
     */
32
    protected $url;
33
34
    /**
35
     * @ORM\OneToMany(targetEntity="Media", mappedBy="product", cascade={"all"}, orphanRemoval=true)
36
     */
37
    protected $medias;
38
39
    public function __construct()
40
    {
41
        $this->medias = new \Doctrine\Common\Collections\ArrayCollection();
42
    }
43
44
    public function getId()
45
    {
46
        return $this->id;
47
    }
48
49
    public function getTitle()
50
    {
51
        return $this->title;
52
    }
53
54
    public function setTitle($title)
55
    {
56
        $this->title = $title;
57
58
        return $this;
59
    }
60
61
    public function getDescription()
62
    {
63
        return $this->description;
64
    }
65
66
    public function setDescription($description)
67
    {
68
        $this->description = $description;
69
70
        return $this;
71
    }
72
73
    public function getUrl()
74
    {
75
        return $this->url;
76
    }
77
78
    public function setUrl($url)
79
    {
80
        $this->url = $url;
81
82
        return $this;
83
    }
84
85
    public function getMedias()
86
    {
87
        return $this->medias;
88
    }
89
90
    public function addMedia(Media $media)
91
    {
92
        if (!$this->medias->contains($media)) {
93
            $media->setProduct($this);
94
            $this->medias->add($media);
95
        }
96
97
        return $this;
98
    }
99
100
    public function removeMedia(Media $media)
101
    {
102
        if ($this->medias->contains($media)) {
103
            $this->medias->removeElement($media);
104
        }
105
106
        return $this;
107
    }
108
}
109