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