Completed
Push — master ( 992272...53e0af )
by Artem
07:29
created

UserA::addUserPictures()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/*
3
 * This file is part of the FreshVichUploaderSerializationBundle
4
 *
5
 * (c) Artem Genvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fresh\VichUploaderSerializationBundle\Tests\Fixtures;
12
13
use Doctrine\ORM\Mapping as ORM;
14
use Fresh\VichUploaderSerializationBundle\Annotation as Fresh;
15
use JMS\Serializer\Annotation as JMS;
16
use Symfony\Component\HttpFoundation\File\File;
17
use Vich\UploaderBundle\Mapping\Annotation as Vich;
18
19
/**
20
 * UserA Entity
21
 *
22
 * @ORM\Table(name="users")
23
 * @ORM\Entity()
24
 *
25
 * @JMS\ExclusionPolicy("all")
26
 *
27
 * @Vich\Uploadable
28
 * @Fresh\VichSerializableClass
29
 */
30
class UserA
31
{
32
    /**
33
     * @var string $photoName Photo name
34
     *
35
     * @ORM\Column(type="string", length=255)
36
     *
37
     * @JMS\Expose
38
     * @JMS\SerializedName("photo")
39
     *
40
     * @Fresh\VichSerializableField("photoFile")
41
     */
42
    private $photoName;
43
44
    /**
45
     * @var File $photoFile Photo file
46
     *
47
     * @JMS\Exclude
48
     *
49
     * @Vich\UploadableField(mapping="user_photo_mapping", fileNameProperty="photoName")
50
     */
51
    private $photoFile;
52
53
    /**
54
     * @var string $coverName Cover name
55
     *
56
     * @ORM\Column(type="string", length=255)
57
     *
58
     * @JMS\Expose
59
     * @JMS\SerializedName("cover")
60
     *
61
     * @Fresh\VichSerializableField("coverFile")
62
     */
63
    private $coverName;
64
65
    /**
66
     * @var File $coverFile Cover file
67
     *
68
     * @JMS\Exclude
69
     *
70
     * @Vich\UploadableField(mapping="user_cover_mapping", fileNameProperty="coverName")
71
     */
72
    private $coverFile;
73
74
    /**
75
     * @ORM\OneToMany(targetEntity="Fresh\VichUploaderSerializationBundle\Tests\Fixtures\UserPictures", mappedBy="user")
76
     */
77
    protected $userPictures;
78
79
    /**
80
     * To string
81
     *
82
     * @return string
83
     */
84
    public function __toString()
85
    {
86
        $result = 'New User';
87
88
        return $result;
89
    }
90
91
    /**
92
     * Get photo name
93
     *
94
     * @return string Photo name
95
     */
96
    public function getPhotoName()
97
    {
98
        return $this->photoName;
99
    }
100
101
    /**
102
     * Set photo name
103
     *
104
     * @param string $photoName Photo name
105
     *
106
     * @return $this
107
     */
108
    public function setPhotoName($photoName)
109
    {
110
        $this->photoName = $photoName;
111
112
        return $this;
113
    }
114
115
    /**
116
     * Get photo file
117
     *
118
     * @return File Photo file
119
     */
120
    public function getPhotoFile()
121
    {
122
        return $this->photoFile;
123
    }
124
125
    /**
126
     * Set photo file
127
     *
128
     * @param File $photoFile Photo file
129
     *
130
     * @return $this
131
     */
132
    public function setPhotoFile(File $photoFile)
133
    {
134
        $this->photoFile = $photoFile;
135
136
        return $this;
137
    }
138
139
    /**
140
     * Get cover name
141
     *
142
     * @return string Cover name
143
     */
144
    public function getCoverName()
145
    {
146
        return $this->coverName;
147
    }
148
149
    /**
150
     * Set cover name
151
     *
152
     * @param string $coverName Cover name
153
     *
154
     * @return $this
155
     */
156
    public function setCoverName($coverName)
157
    {
158
        $this->coverName = $coverName;
159
160
        return $this;
161
    }
162
163
    /**
164
     * Get cover file
165
     *
166
     * @return File Cover file
167
     */
168
    public function getCoverFile()
169
    {
170
        return $this->coverFile;
171
    }
172
173
    /**
174
     * Set cover file
175
     *
176
     * @param File $coverFile Cover file
177
     *
178
     * @return $this
179
     */
180
    public function setCoverFile(File $coverFile)
181
    {
182
        $this->coverFile = $coverFile;
183
184
        return $this;
185
    }
186
187
    /**
188
     * Add userPictures
189
     *
190
     * @param UserPictures $userPictures
191
     *
192
     * @return $this
193
     */
194
    public function addUserPictures(UserPictures $userPictures)
195
    {
196
        $this->userPictures[] = $userPictures;
197
198
        return $this;
199
    }
200
201
    /**
202
     * Remove userPictures
203
     *
204
     * @param UserPictures $userPictures
205
     */
206
    public function removeUserPictures(UserPictures $userPictures)
207
    {
208
        $this->userPictures->removeElement($userPictures);
0 ignored issues
show
Bug introduced by
The method removeElement cannot be called on $this->userPictures (of type array<integer,object<Fre...Fixtures\UserPictures>>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
209
    }
210
211
    /**
212
     * Get userPictures
213
     *
214
     * @return \Doctrine\Common\Collections\Collection
215
     */
216
    public function getUserPictures()
217
    {
218
        return $this->userPictures;
219
    }
220
}
221