Skip to content

Commit 51bda9e

Browse files
authored
chore(file-upload): modernize to an existing resource part (#2059)
1 parent 32a7cdc commit 51bda9e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

core/file-upload.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,7 @@ use Symfony\Component\HttpFoundation\File\File;
349349
use Symfony\Component\Serializer\Annotation\Groups;
350350
use Vich\UploaderBundle\Mapping\Annotation as Vich;
351351

352-
/**
353-
* @Vich\Uploadable
354-
*/
352+
#[Vich\Uploadable]
355353
#[ORM\Entity]
356354
#[ApiResource(
357355
normalizationContext: ['groups' => ['book:read']],
@@ -373,9 +371,10 @@ class Book
373371
#[Groups(['book:read'])]
374372
public ?string $contentUrl = null;
375373

376-
/**
377-
* @Vich\UploadableField(mapping="media_object", fileNameProperty="filePath")
378-
*/
374+
#[Vich\UploadableField(
375+
mapping: 'media_object',
376+
fileNameProperty: 'filePath',
377+
)]
379378
#[Groups(['book:write'])]
380379
public ?File $file = null;
381380

@@ -404,7 +403,7 @@ final class MultipartDecoder implements DecoderInterface
404403
{
405404
public const FORMAT = 'multipart';
406405

407-
public function __construct(private RequestStack $requestStack)
406+
public function __construct(private readonly RequestStack $requestStack)
408407
{
409408
}
410409

@@ -459,8 +458,6 @@ final class UploadedFileDenormalizer implements DenormalizerInterface
459458
public function getSupportedTypes(?string $format): array
460459
{
461460
return [
462-
'object' => null,
463-
'*' => false,
464461
File::class => true,
465462
];
466463
}

0 commit comments

Comments
 (0)