ソースを参照

mapped image url

master
Daniel 2年前
コミット
1b2c284535
6個のファイルの変更93行の追加49行の削除
  1. +84
    -45
      openapi.yaml
  2. +3
    -0
      src/ApiResource/ContactApi.php
  3. +2
    -0
      src/ApiResource/PartnerApi.php
  4. +1
    -0
      src/Mapper/ContactEntityToApiMapper.php
  5. +3
    -3
      src/Mapper/PartnerEntityToApiMapper.php
  6. +0
    -1
      src/Serializer/MediaObjectNormalizer.php

+ 84
- 45
openapi.yaml ファイルの表示

@@ -1119,11 +1119,12 @@ components:
- string
- 'null'
partner:
anyOf:
-
$ref: '#/components/schemas/Partner'
-
type: 'null'
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
birthday:
type:
- string
@@ -1136,6 +1137,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
imageUrl:
type:
- string
- 'null'
position:
type:
- string
@@ -1179,11 +1184,12 @@ components:
- string
- 'null'
partner:
anyOf:
-
$ref: '#/components/schemas/Partner.jsonhal'
-
type: 'null'
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
birthday:
type:
- string
@@ -1196,6 +1202,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
imageUrl:
type:
- string
- 'null'
position:
type:
- string
@@ -1253,11 +1263,12 @@ components:
- string
- 'null'
partner:
anyOf:
-
$ref: '#/components/schemas/Partner.jsonld'
-
type: 'null'
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
birthday:
type:
- string
@@ -1270,6 +1281,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
imageUrl:
type:
- string
- 'null'
position:
type:
- string
@@ -1362,10 +1377,10 @@ components:
type: object
description: ''
deprecated: false
required:
- name
- type
properties:
id:
readOnly: true
type: integer
name:
type: string
type:
@@ -1398,13 +1413,6 @@ components:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
contacts:
type: array
items:
$ref: '#/components/schemas/Contact'
logo:
'owl:maxCardinality': 1
type:
@@ -1412,10 +1420,28 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
logoUrl:
type:
- string
- 'null'
createdAt:
type:
- string
- 'null'
format: date-time
contacts:
type: array
items:
type: string
format: iri-reference
example: 'https://example.com/'
Partner.jsonhal:
type: object
description: ''
deprecated: false
required:
- name
- type
properties:
_links:
type: object
@@ -1426,9 +1452,6 @@ components:
href:
type: string
format: iri-reference
id:
readOnly: true
type: integer
name:
type: string
type:
@@ -1461,13 +1484,6 @@ components:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
contacts:
type: array
items:
$ref: '#/components/schemas/Contact.jsonhal'
logo:
'owl:maxCardinality': 1
type:
@@ -1475,10 +1491,28 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
logoUrl:
type:
- string
- 'null'
createdAt:
type:
- string
- 'null'
format: date-time
contacts:
type: array
items:
type: string
format: iri-reference
example: 'https://example.com/'
Partner.jsonld:
type: object
description: ''
deprecated: false
required:
- name
- type
properties:
'@context':
readOnly: true
@@ -1503,9 +1537,6 @@ components:
'@type':
readOnly: true
type: string
id:
readOnly: true
type: integer
name:
type: string
type:
@@ -1538,13 +1569,6 @@ components:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
contacts:
type: array
items:
$ref: '#/components/schemas/Contact.jsonld'
logo:
'owl:maxCardinality': 1
type:
@@ -1552,6 +1576,21 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
logoUrl:
type:
- string
- 'null'
createdAt:
type:
- string
- 'null'
format: date-time
contacts:
type: array
items:
type: string
format: iri-reference
example: 'https://example.com/'
Post:
type: object
description: ''


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

@@ -45,6 +45,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: Contact::class),
)]

class ContactApi
{
#[ApiProperty(readable: false, writable: false, identifier: true)]
@@ -62,6 +63,8 @@ class ContactApi

public ?MediaObject $image = null;

public ?string $imageUrl = null;

public ?string $position = null;

public ?string $phone = null;


+ 2
- 0
src/ApiResource/PartnerApi.php ファイルの表示

@@ -77,6 +77,8 @@ class PartnerApi

public ?MediaObject $logo = null;

public ?string $logoUrl = null;

public ?\DateTimeImmutable $createdAt = null;

/**


+ 1
- 0
src/Mapper/ContactEntityToApiMapper.php ファイルの表示

@@ -46,6 +46,7 @@ class ContactEntityToApiMapper implements MapperInterface
);
$dto->birthday = $entity->getBirthday();
$dto->image = $entity->getImage();
$dto->imageUrl = $entity->getImage()?->getFilePath();
$dto->position = $entity->getPosition();
$dto->phone = $entity->getPhone();
$dto->email = $entity->getEmail();


+ 3
- 3
src/Mapper/PartnerEntityToApiMapper.php ファイルの表示

@@ -14,9 +14,8 @@ use Symfonycasts\MicroMapper\MicroMapperInterface;
class PartnerEntityToApiMapper implements MapperInterface
{
public function __construct(
private MicroMapperInterface $microMapper,
)
{
private MicroMapperInterface $microMapper
) {
}

public function load(object $from, string $toClass, array $context): object
@@ -46,6 +45,7 @@ class PartnerEntityToApiMapper implements MapperInterface
$dto->country = $entity->getCountry();
$dto->website = $entity->getWebsite();
$dto->logo = $entity->getLogo();
$dto->logoUrl = $entity->getLogo()?->getFilePath();
$dto->createdAt = $entity->getCreatedAt();
$dto->contacts = array_map(function(Contact $contact) {
return $this->microMapper->map($contact, ContactApi::class, [


+ 0
- 1
src/Serializer/MediaObjectNormalizer.php ファイルの表示

@@ -15,7 +15,6 @@ use Symfony\Component\Serializer\SerializerAwareInterface;
use Symfony\Component\Serializer\SerializerInterface;
use Vich\UploaderBundle\Storage\StorageInterface;

//final class MediaObjectNormalizer
#[AsDecorator('api_platform.jsonld.normalizer.item')]
final class MediaObjectNormalizer implements NormalizerInterface, SerializerAwareInterface
{


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