Completed
Push — master ( d19d30...257f70 )
by Joachim
13:38
created

Manufacturer::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Loevgaard\DandomainFoundation\Entity\Generated\ManufacturerInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...d\ManufacturerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Loevgaard\DandomainFoundation\Entity\Generated\ManufacturerTrait;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...rated\ManufacturerTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * @ORM\Entity()
12
 * @ORM\Table(name="ldf_manufacturers")
13
 */
14
class Manufacturer extends AbstractEntity implements ManufacturerInterface
15
{
16
    use ManufacturerTrait;
17
18
    protected $hydrateConversions = [
19
        'id' => 'externalId'
20
    ];
21
22
    /**
23
     * @var int
24
     *
25
     * @ORM\Id
26
     * @ORM\GeneratedValue
27
     * @ORM\Column(type="integer")
28
     **/
29
    protected $id;
30
31
    /**
32
     * @var string
33
     *
34
     * @ORM\Column(type="string", unique=true, length=191)
35
     */
36
    protected $externalId;
37
38
    /**
39
     * @var string|null
40
     *
41
     * @ORM\Column(nullable=true, type="string", length=191)
42
     */
43
    protected $link;
44
45
    /**
46
     * @var string|null
47
     *
48
     * @ORM\Column(nullable=true, type="text")
49
     */
50
    protected $linkText;
51
52
    /**
53
     * @var string|null
54
     *
55
     * @ORM\Column(nullable=true, type="string", length=191)
56
     */
57
    protected $name;
58
59
    /**
60
     * @var Product[]|ArrayCollection
61
     *
62
     * @ORM\ManyToMany(mappedBy="manufacturers", targetEntity="Product", fetch="EXTRA_LAZY")
63
     */
64
    protected $products;
65
66
    public function __construct()
67
    {
68
        $this->products = new ArrayCollection();
69
    }
70
71
    public function __toString()
72
    {
73
        return (string)$this->name;
74
    }
75
76
    /**
77
     * @return int
78
     */
79
    public function getId(): int
80
    {
81
        return (int)$this->id;
82
    }
83
84
    /**
85
     * @param int $id
86
     * @return ManufacturerInterface
87
     */
88
    public function setId(int $id)
89
    {
90
        $this->id = $id;
91
        return $this;
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function getExternalId(): string
98
    {
99
        return (string)$this->externalId;
100
    }
101
102
    /**
103
     * @param string $externalId
104
     * @return ManufacturerInterface
105
     */
106
    public function setExternalId(string $externalId)
107
    {
108
        $this->externalId = $externalId;
109
        return $this;
110
    }
111
112
    /**
113
     * @return null|string
114
     */
115
    public function getLink()
116
    {
117
        return $this->link;
118
    }
119
120
    /**
121
     * @param null|string $link
122
     * @return ManufacturerInterface
123
     */
124
    public function setLink($link)
125
    {
126
        $this->link = $link;
127
        return $this;
128
    }
129
130
    /**
131
     * @return null|string
132
     */
133
    public function getLinkText()
134
    {
135
        return $this->linkText;
136
    }
137
138
    /**
139
     * @param null|string $linkText
140
     * @return ManufacturerInterface
141
     */
142
    public function setLinkText($linkText)
143
    {
144
        $this->linkText = $linkText;
145
        return $this;
146
    }
147
148
    /**
149
     * @return null|string
150
     */
151
    public function getName()
152
    {
153
        return $this->name;
154
    }
155
156
    /**
157
     * @param null|string $name
158
     * @return ManufacturerInterface
159
     */
160
    public function setName($name)
161
    {
162
        $this->name = $name;
163
        return $this;
164
    }
165
166
    /**
167
     * @return ArrayCollection|Product[]
168
     */
169
    public function getProducts()
170
    {
171
        return $this->products;
172
    }
173
174
    /**
175
     * @param ArrayCollection|Product[] $products
176
     * @return ManufacturerInterface
177
     */
178
    public function setProducts($products)
179
    {
180
        $this->products = $products;
181
        return $this;
182
    }
183
}
184