| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public function load(ObjectManager $manager): void |
||
| 24 | { |
||
| 25 | $fs = new Filesystem(); |
||
| 26 | $finder = new Finder(); |
||
| 27 | foreach ($finder->in(__DIR__ . '/image/two')->name('/\.jpg$/i') as $source) { |
||
| 28 | |||
| 29 | $image = new Image(); |
||
| 30 | |||
| 31 | $targetPath = sys_get_temp_dir() . '/' . $source->getFilename(); |
||
| 32 | $fs->copy($source->getPathname(), $targetPath); |
||
| 33 | $uploadedFake = new UploadedFile($targetPath, $source->getFilename(), 'image/jpeg', null, true); |
||
| 34 | $image->setImageFile($uploadedFake); |
||
| 35 | $manager->persist($image); |
||
| 36 | } |
||
| 37 | $manager->flush(); |
||
| 38 | } |
||
| 40 |