Vich\Uploadable - Use attributes

pull/3996/head
Julio 3 years ago
parent 42328f828d
commit 5e21429fca
  1. 21
      src/CoreBundle/Entity/Asset.php
  2. 20
      src/CoreBundle/Entity/ResourceFile.php

@ -20,10 +20,9 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity
* @Vich\Uploadable
*
* @ORM\Table(name="asset")
*/
#[Vich\Uploadable]
class Asset
{
use TimestampableEntity;
@ -63,16 +62,14 @@ class Asset
#[Assert\NotBlank]
protected ?string $category = null;
/**
* @Vich\UploadableField(
* mapping="assets",
* fileNameProperty="title",
* size="size",
* mimeType="mimeType",
* originalName="originalName",
* dimensions="dimensions"
* )
*/
#[Vich\UploadableField(
mapping: 'assets',
fileNameProperty: 'title',
size: 'size',
mimeType: 'mimeType',
originalName: 'originalName',
dimensions: 'dimensions'
)]
#[Assert\NotNull]
protected File $file;

@ -63,10 +63,10 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
* )
* @ApiFilter(OrderFilter::class, properties={"id", "name", "size", "updatedAt"})
* @ORM\Entity
* @Vich\Uploadable
*
* @ORM\Table(name="resource_file")
*/
#[Vich\Uploadable]
#[ApiFilter(PropertyFilter::class)]
#[ApiFilter(SearchFilter::class, properties: [
'name' => 'partial',
@ -116,16 +116,14 @@ class ResourceFile
*/
protected ?int $size = 0;
/**
* @Vich\UploadableField(
* mapping="resources",
* fileNameProperty="name",
* size="size",
* mimeType="mimeType",
* originalName="originalName",
* dimensions="dimensions"
* )
*/
#[Vich\UploadableField(
mapping: 'resources',
fileNameProperty: 'name',
size: 'size',
mimeType: 'mimeType',
originalName: 'originalName',
dimensions: 'dimensions'
)]
protected ?File $file = null;
/**

Loading…
Cancel
Save