1 | <?php |
||
16 | class MediaItemImport |
||
17 | { |
||
18 | /** |
||
19 | * @var string |
||
20 | * |
||
21 | * @ORM\Id() |
||
22 | * @ORM\GeneratedValue(strategy="UUID") |
||
23 | * @ORM\Column(type="guid") |
||
24 | */ |
||
25 | protected $id; |
||
26 | |||
27 | /** |
||
28 | * @var Status |
||
29 | * |
||
30 | * @ORM\Column(type="media_item_import_status") |
||
31 | */ |
||
32 | protected $status; |
||
33 | |||
34 | /** |
||
35 | * @var Method |
||
36 | * |
||
37 | * @ORM\Column(type="media_item_import_method") |
||
38 | */ |
||
39 | protected $method; |
||
40 | |||
41 | /** |
||
42 | * @var int |
||
43 | * |
||
44 | * @ORM\Column(type="integer") |
||
45 | */ |
||
46 | protected $sequence; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | * |
||
51 | * @ORM\Column(type="string") |
||
52 | */ |
||
53 | protected $path; |
||
54 | |||
55 | /** |
||
56 | * @var string|null |
||
57 | * |
||
58 | * @ORM\Column(type="string", nullable=true) |
||
59 | */ |
||
60 | protected $title; |
||
61 | |||
62 | /** |
||
63 | * @var MediaGroup |
||
64 | * |
||
65 | * @ORM\ManyToOne( |
||
66 | * targetEntity="Backend\Modules\MediaLibrary\Domain\MediaGroup\MediaGroup", |
||
67 | * cascade="persist", |
||
68 | * fetch="EAGER" |
||
69 | * ) |
||
70 | * @ORM\JoinColumn( |
||
71 | * name="mediaGroupId", |
||
72 | * referencedColumnName="id", |
||
73 | * onDelete="cascade", |
||
74 | * nullable=false |
||
75 | * ) |
||
76 | */ |
||
77 | protected $mediaGroup; |
||
78 | |||
79 | /** |
||
80 | * @var MediaItem|null |
||
81 | * |
||
82 | * @ORM\ManyToOne( |
||
83 | * targetEntity="Backend\Modules\MediaLibrary\Domain\MediaItem\MediaItem", |
||
84 | * cascade="persist" |
||
85 | * ) |
||
86 | * @ORM\JoinColumn( |
||
87 | * name="mediaItemId", |
||
88 | * referencedColumnName="id", |
||
89 | * onDelete="cascade" |
||
90 | * ) |
||
91 | */ |
||
92 | protected $mediaItem; |
||
93 | |||
94 | /** |
||
95 | * @var \DateTime |
||
96 | * |
||
97 | * @ORM\Column(type="datetime") |
||
98 | */ |
||
99 | protected $createdOn; |
||
100 | |||
101 | /** |
||
102 | * @var \DateTime |
||
103 | * |
||
104 | * @ORM\Column(type="datetime", nullable=true) |
||
105 | */ |
||
106 | protected $executedOn; |
||
107 | |||
108 | /** |
||
109 | * @var \DateTime |
||
110 | * |
||
111 | * @ORM\Column(type="datetime", nullable=true) |
||
112 | */ |
||
113 | protected $importedOn; |
||
114 | |||
115 | /** |
||
116 | * @var string |
||
117 | * |
||
118 | * @ORM\Column(type="text", nullable=true) |
||
119 | */ |
||
120 | protected $errorMessage; |
||
121 | |||
122 | /** |
||
123 | * @param MediaGroup $mediaGroup |
||
124 | * @param string $path |
||
125 | * @param int $sequence |
||
126 | * @param Method $method |
||
127 | * @param string $title |
||
128 | */ |
||
129 | private function __construct( |
||
142 | |||
143 | /** |
||
144 | * @param MediaItemImportDataTransferObject $mediaItemDataTransferObject |
||
145 | * @return MediaItemImport |
||
146 | */ |
||
147 | public static function fromDataTransferObject( |
||
158 | |||
159 | /** |
||
160 | * Gets the value of id. |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | public function getId(): string |
||
168 | |||
169 | /** |
||
170 | * @return Status |
||
171 | */ |
||
172 | public function getStatus(): Status |
||
176 | |||
177 | /** |
||
178 | * @param string $errorMessage |
||
179 | */ |
||
180 | public function changeStatusToError(string $errorMessage) |
||
185 | |||
186 | /** |
||
187 | * @param MediaItem $mediaItem |
||
188 | */ |
||
189 | public function changeStatusToExisting(MediaItem $mediaItem) |
||
199 | |||
200 | /** |
||
201 | * @param string $path |
||
202 | * @param MediaFolder $mediaFolder |
||
203 | * @param int $userId |
||
204 | */ |
||
205 | public function changeStatusToImported( |
||
220 | |||
221 | /** |
||
222 | * @return Method |
||
223 | */ |
||
224 | public function getMethod(): Method |
||
228 | |||
229 | /** |
||
230 | * @return string |
||
231 | */ |
||
232 | public function getPath(): string |
||
236 | |||
237 | /** |
||
238 | * @return int |
||
239 | */ |
||
240 | public function getSequence(): int |
||
244 | |||
245 | /** |
||
246 | * Gets the value of createdOn. |
||
247 | * |
||
248 | * @return \DateTime |
||
249 | */ |
||
250 | public function getCreatedOn(): \DateTime |
||
254 | |||
255 | /** |
||
256 | * @return \DateTime |
||
257 | */ |
||
258 | public function getImportedOn(): \DateTime |
||
262 | |||
263 | /** |
||
264 | * @return \DateTime |
||
265 | */ |
||
266 | public function getExecutedOn(): \DateTime |
||
270 | |||
271 | /** |
||
272 | * @return MediaGroup |
||
273 | */ |
||
274 | public function getMediaGroup(): MediaGroup |
||
278 | |||
279 | /** |
||
280 | * @return MediaItem|null |
||
281 | */ |
||
282 | public function getMediaItem() |
||
286 | |||
287 | /** |
||
288 | * @return string|null |
||
289 | */ |
||
290 | public function getTitle(): string |
||
294 | |||
295 | /** |
||
296 | * @return string |
||
297 | */ |
||
298 | public function getErrorMessage(): string |
||
302 | |||
303 | /** |
||
304 | * @ORM\PrePersist |
||
305 | */ |
||
306 | public function onPrePersist() |
||
310 | |||
311 | /** |
||
312 | * @ORM\PreUpdate |
||
313 | */ |
||
314 | public function onPreUpdate() |
||
318 | } |
||
319 |