Explorar el Código

small fixes

master
Florian Eisenmenger hace 2 años
padre
commit
15ea082543
Se han modificado 2 ficheros con 4 adiciones y 2 borrados
  1. +1
    -1
      src/ApiResource/ContactApi.php
  2. +3
    -1
      src/Mapper/ContactEntityToApiMapper.php

+ 1
- 1
src/ApiResource/ContactApi.php Ver fichero

@@ -41,7 +41,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
security: 'is_granted("ROLE_ADMIN")',
)
],
paginationItemsPerPage: 10,
paginationItemsPerPage: 6,
security: 'is_granted("ROLE_USER")',
provider: EntityToDtoStateProvider::class,
processor: EntityClassDtoStateProcessor::class,


+ 3
- 1
src/Mapper/ContactEntityToApiMapper.php Ver fichero

@@ -9,12 +9,14 @@ use App\Entity\Partner;
use Symfonycasts\MicroMapper\AsMapper;
use Symfonycasts\MicroMapper\MapperInterface;
use Symfonycasts\MicroMapper\MicroMapperInterface;
use Vich\UploaderBundle\Storage\StorageInterface;

#[AsMapper(from: Contact::class, to: ContactApi::class)]
class ContactEntityToApiMapper implements MapperInterface
{
public function __construct(
private MicroMapperInterface $microMapper,
private StorageInterface $storage
)
{
}
@@ -46,7 +48,7 @@ class ContactEntityToApiMapper implements MapperInterface
);
$dto->birthday = $entity->getBirthday();
$dto->image = $entity->getImage();
$dto->imageUrl = $entity->getImage()?->getContentUrl();
$dto->imageUrl = $entity->getImage() !== null ? $this->storage->resolveUri($entity->getImage(), 'file') : null;
$dto->position = $entity->getPosition();
$dto->phone = $entity->getPhone();
$dto->email = $entity->getEmail();


Cargando…
Cancelar
Guardar