Przeglądaj źródła

small fixes

master
Florian Eisenmenger 2 lat temu
rodzic
commit
15ea082543
2 zmienionych plików z 4 dodań i 2 usunięć
  1. +1
    -1
      src/ApiResource/ContactApi.php
  2. +3
    -1
      src/Mapper/ContactEntityToApiMapper.php

+ 1
- 1
src/ApiResource/ContactApi.php Wyświetl plik

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


+ 3
- 1
src/Mapper/ContactEntityToApiMapper.php Wyświetl plik

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


#[AsMapper(from: Contact::class, to: ContactApi::class)] #[AsMapper(from: Contact::class, to: ContactApi::class)]
class ContactEntityToApiMapper implements MapperInterface class ContactEntityToApiMapper implements MapperInterface
{ {
public function __construct( public function __construct(
private MicroMapperInterface $microMapper, private MicroMapperInterface $microMapper,
private StorageInterface $storage
) )
{ {
} }
@@ -46,7 +48,7 @@ class ContactEntityToApiMapper implements MapperInterface
); );
$dto->birthday = $entity->getBirthday(); $dto->birthday = $entity->getBirthday();
$dto->image = $entity->getImage(); $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->position = $entity->getPosition();
$dto->phone = $entity->getPhone(); $dto->phone = $entity->getPhone();
$dto->email = $entity->getEmail(); $dto->email = $entity->getEmail();


Ładowanie…
Anuluj
Zapisz