Completed
Push — master ( 53e0af...4d0df8 )
by Artem
04:47
created

UserPicture::getPhotoFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
use Doctrine\Common\Persistence\Proxy;
19
20
/**
21
 * UserPictures Entity
22
 *
23
 * @ORM\Table(name="userPictures")
24
 * @ORM\Entity()
25
 *
26
 * @JMS\ExclusionPolicy("all")
27
 *
28
 * @Vich\Uploadable
29
 * @Fresh\VichSerializableClass
30
 */
31
class UserPicture implements Proxy
32
{
33
    /**
34
     * @var UserA $user User
35
     *
36
     * @ORM\ManyToOne(targetEntity="Fresh\VichUploaderSerializationBundle\Tests\Fixtures\UserA", inversedBy="pictures")
37
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
38
     */
39
    private $user;
40
41
    /**
42
     * @var string $photoName Photo name
43
     *
44
     * @ORM\Column(type="string", length=255)
45
     *
46
     * @JMS\Expose
47
     * @JMS\SerializedName("photo")
48
     *
49
     * @Fresh\VichSerializableField("photoFile")
50
     */
51
    private $photoName;
52
53
    /**
54
     * @var File $photoFile Photo file
55
     *
56
     * @JMS\Exclude
57
     *
58
     * @Vich\UploadableField(mapping="user_photo_mapping", fileNameProperty="photoName")
59
     */
60
    private $photoFile;
61
62
    /**
63
     * @var string $coverName Cover name
64
     *
65
     * @ORM\Column(type="string", length=255)
66
     *
67
     * @JMS\Expose
68
     * @JMS\SerializedName("cover")
69
     *
70
     * @Fresh\VichSerializableField("coverFile")
71
     */
72
    private $coverName;
73
74
    /**
75
     * @var File $coverFile Cover file
76
     *
77
     * @JMS\Exclude
78
     *
79
     * @Vich\UploadableField(mapping="user_cover_mapping", fileNameProperty="coverName")
80
     */
81
    private $coverFile;
82
83
    /**
84
     * @var bool $status Status
85
     */
86
    private $status = false;
87
88
    /**
89
     * @inheritdoc
90
     */
91
    public function __load()
92
    {
93
        $this->setPhotoName('photo.jpg')
94
             ->setCoverName('cover.jpg');
95
        $this->status = true;
96
    }
97
98
    /**
99
     * {@inheritdoc}
100
     */
101
    public function __isInitialized()
102
    {
103
        return $this->status;
104
    }
105
106
    /**
107
     * To string
108
     *
109
     * @return string
110
     */
111
    public function __toString()
112
    {
113
        $result = 'New User Picture';
114
115
        return $result;
116
    }
117
118
    /**
119
     * Set user
120
     *
121
     * @param UserA $user User
122
     *
123
     * @return $this
124
     */
125
    public function setUser(UserA $user = null)
126
    {
127
        $this->user = $user;
128
129
        return $this;
130
    }
131
132
    /**
133
     * Get user
134
     *
135
     * @return UserA User
136
     */
137
    public function getUser()
138
    {
139
        return $this->user;
140
    }
141
142
    /**
143
     * Get photo name
144
     *
145
     * @return string Photo name
146
     */
147
    public function getPhotoName()
148
    {
149
        return $this->photoName;
150
    }
151
152
    /**
153
     * Set photo name
154
     *
155
     * @param string $photoName Photo name
156
     *
157
     * @return $this
158
     */
159
    public function setPhotoName($photoName)
160
    {
161
        $this->photoName = $photoName;
162
163
        return $this;
164
    }
165
166
    /**
167
     * Get photo file
168
     *
169
     * @return File Photo file
170
     */
171
    public function getPhotoFile()
172
    {
173
        return $this->photoFile;
174
    }
175
176
    /**
177
     * Set photo file
178
     *
179
     * @param File $photoFile Photo file
180
     *
181
     * @return $this
182
     */
183
    public function setPhotoFile(File $photoFile)
184
    {
185
        $this->photoFile = $photoFile;
186
187
        return $this;
188
    }
189
190
    /**
191
     * Get cover name
192
     *
193
     * @return string Cover name
194
     */
195
    public function getCoverName()
196
    {
197
        return $this->coverName;
198
    }
199
200
    /**
201
     * Set cover name
202
     *
203
     * @param string $coverName Cover name
204
     *
205
     * @return $this
206
     */
207
    public function setCoverName($coverName)
208
    {
209
        $this->coverName = $coverName;
210
211
        return $this;
212
    }
213
214
    /**
215
     * Get cover file
216
     *
217
     * @return File Cover file
218
     */
219
    public function getCoverFile()
220
    {
221
        return $this->coverFile;
222
    }
223
224
    /**
225
     * Set cover file
226
     *
227
     * @param File $coverFile Cover file
228
     *
229
     * @return $this
230
     */
231
    public function setCoverFile(File $coverFile)
232
    {
233
        $this->coverFile = $coverFile;
234
235
        return $this;
236
    }
237
}
238