Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
32 | public function upload(AbstractComponentFactory $factory, array $data, File $file, string $field = 'filePath'): FileInterface |
||
33 | { |
||
34 | $entity = $factory->create($data); |
||
35 | if (!($entity instanceof FileInterface)) { |
||
36 | throw new \Exception('Invalid entity returned from FixtureFileUploader::upload factory'); |
||
37 | } |
||
38 | $uploadedFile = new UploadedFile( |
||
39 | $file->getRealPath(), |
||
40 | $file->getFilename(), |
||
41 | null, |
||
42 | null, |
||
43 | true |
||
44 | ); |
||
45 | $this->fileUploader->upload($entity, $field, $uploadedFile); |
||
46 | return $entity; |
||
47 | } |
||
49 |