Code Duplication    Length = 125-125 lines in 2 locations

src/Entity/Label.php 1 location

@@ 25-149 (lines=125) @@
22
 *
23
 * @author  Peter Gribanov <[email protected]>
24
 */
25
class Label
26
{
27
    /**
28
     * @ORM\Id
29
     * @ORM\GeneratedValue
30
     * @ORM\Column(type="integer")
31
     *
32
     * @var int
33
     */
34
    protected $id = 0;
35
36
    /**
37
     * @ORM\Column(type="string", length=16)
38
     * @Assert\NotBlank()
39
     *
40
     * @var string
41
     */
42
    protected $name = '';
43
44
    /**
45
     * @ORM\ManyToMany(targetEntity="Item", mappedBy="labels")
46
     *
47
     * @var ArrayCollection
48
     */
49
    protected $items;
50
51
    public function __construct()
52
    {
53
        $this->items = new ArrayCollection();
54
    }
55
56
    /**
57
     * @return int
58
     */
59
    public function getId()
60
    {
61
        return $this->id;
62
    }
63
64
    /**
65
     * @param string $name
66
     *
67
     * @return Label
68
     */
69
    public function setName($name)
70
    {
71
        $this->name = $name;
72
73
        return $this;
74
    }
75
76
    /**
77
     * @return string
78
     */
79
    public function getName()
80
    {
81
        return $this->name;
82
    }
83
84
    /**
85
     * @param Item $item
86
     *
87
     * @return Label
88
     */
89
    public function addItem(Item $item)
90
    {
91
        if (!$this->items->contains($item)) {
92
            $this->items->add($item);
93
            $item->addLabel($this);
94
        }
95
96
        return $this;
97
    }
98
99
    /**
100
     * @param Item $item
101
     *
102
     * @return Label
103
     */
104
    public function removeItem(Item $item)
105
    {
106
        if ($this->items->contains($item)) {
107
            $this->items->removeElement($item);
108
            $item->removeLabel($this);
109
        }
110
111
        return $this;
112
    }
113
114
    /**
115
     * @return ArrayCollection
116
     */
117
    public function getItems()
118
    {
119
        return $this->items;
120
    }
121
122
    /**
123
     * @return string
124
     */
125
    public function __toString()
126
    {
127
        return $this->getName();
128
    }
129
}
130

src/Entity/Studio.php 1 location

@@ 22-146 (lines=125) @@
19
 *
20
 * @author  Peter Gribanov <[email protected]>
21
 */
22
class Studio
23
{
24
    /**
25
     * @ORM\Id
26
     * @ORM\GeneratedValue
27
     * @ORM\Column(type="integer")
28
     *
29
     * @var int
30
     */
31
    protected $id = 0;
32
33
    /**
34
     * @ORM\Column(type="string", length=128)
35
     * @Assert\NotBlank()
36
     *
37
     * @var string
38
     */
39
    protected $name = '';
40
41
    /**
42
     * @ORM\OneToMany(targetEntity="Item", mappedBy="studio")
43
     *
44
     * @var ArrayCollection
45
     */
46
    protected $items;
47
48
    public function __construct()
49
    {
50
        $this->items = new ArrayCollection();
51
    }
52
53
    /**
54
     * @return int
55
     */
56
    public function getId()
57
    {
58
        return $this->id;
59
    }
60
61
    /**
62
     * @param string $name
63
     *
64
     * @return Studio
65
     */
66
    public function setName($name)
67
    {
68
        $this->name = $name;
69
70
        return $this;
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function getName()
77
    {
78
        return $this->name;
79
    }
80
81
    /**
82
     * @param Item $item
83
     *
84
     * @return Studio
85
     */
86
    public function addItem(Item $item)
87
    {
88
        if (!$this->items->contains($item)) {
89
            $this->items->add($item);
90
            $item->setStudio($this);
91
        }
92
93
        return $this;
94
    }
95
96
    /**
97
     * @param Item $item
98
     *
99
     * @return Studio
100
     */
101
    public function removeItem(Item $item)
102
    {
103
        if ($this->items->contains($item)) {
104
            $this->items->removeElement($item);
105
            $item->setStudio(null);
106
        }
107
108
        return $this;
109
    }
110
111
    /**
112
     * @return ArrayCollection
113
     */
114
    public function getItems()
115
    {
116
        return $this->items;
117
    }
118
119
    /**
120
     * @return string
121
     */
122
    public function __toString()
123
    {
124
        return $this->getName();
125
    }
126
}
127