Conditions | 5 |
Paths | 6 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | public function uploadMedia(GenericEvent $event): void |
||
25 | { |
||
26 | $subject = $event->getSubject(); |
||
27 | Assert::isInstanceOf($subject, SeoInterface::class); |
||
28 | /** @var SeoTranslation $translation */ |
||
29 | foreach ($subject->getSeo()->getTranslations() as $translation) { |
||
30 | $image = $translation->getImage(); |
||
31 | if ($image instanceof SeoImageInterface) { |
||
32 | if ($image->hasFile()) { |
||
|
|||
33 | $this->uploader->upload($image); |
||
34 | } |
||
35 | // Upload failed? Let's remove that image. |
||
36 | if (null === $image->getPath()) { |
||
37 | $translation->setImage(null); |
||
38 | } |
||
43 |