ソースを参照

small fixes

master
Florian Eisenmenger 2年前
コミット
15ea082543
2個のファイルの変更4行の追加2行の削除
  1. +1
    -1
      src/ApiResource/ContactApi.php
  2. +3
    -1
      src/Mapper/ContactEntityToApiMapper.php

+ 1
- 1
src/ApiResource/ContactApi.php ファイルの表示

@@ -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 ファイルの表示

@@ -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();


読み込み中…
キャンセル
保存