Skip to content

Commit 85eeb83

Browse files
committed
compat
1 parent 9e43d4c commit 85eeb83

File tree

4 files changed

+34
-35
lines changed

4 files changed

+34
-35
lines changed

src/Core/Swagger/Serializer/DocumentationNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ private function updatePostOperation(bool $v3, \ArrayObject $pathOperation, arra
583583
$identifiers = (array) $resourceMetadata
584584
->getTypedOperationAttribute($operationType, $operationName, 'identifiers', [], false);
585585

586-
$pathOperation = $this->addItemOperationParameters($v3, $pathOperation, $operationType, $operationName, $resourceMetadata, $resourceClass, true);
586+
$pathOperation = $this->addItemOperationParameters($v3, $pathOperation, $operationType, $operationName, $resourceMetadata, $resourceClass, $operationType === OperationType::ITEM ? false : true);
587587

588588
$successResponse = ['description' => sprintf('%s resource created', $resourceShortName)];
589589
[$successResponse, $defined] = $this->addSchemas($v3, $successResponse, $definitions, $resourceClass, $operationType, $operationName, $responseMimeTypes);

src/Symfony/Bundle/Resources/config/metadata/resource_name.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
</service>
1212

1313
<!-- Resource name collection -->
14-
<service id="api_platform.metadata.resource.name_collection_factory.attributes" decorates="api_platform.metadata.resource.name_collection_factory" class="ApiPlatform\Metadata\Resource\Factory\AttributesResourceNameCollectionFactory" public="false">
15-
<argument>%api_platform.resource_class_directories%</argument>
16-
<argument type="service" id="api_platform.metadata.resource.name_collection_factory.attributes.inner" />
17-
</service>
18-
1914
<service id="api_platform.metadata.resource.name_collection_factory.cached" class="ApiPlatform\Metadata\Resource\Factory\CachedResourceNameCollectionFactory" decorates="api_platform.metadata.resource.name_collection_factory" decoration-priority="-10" public="false">
2015
<argument type="service" id="api_platform.cache.metadata.resource" />
2116
<argument type="service" id="api_platform.metadata.resource.name_collection_factory.cached.inner" />

src/Symfony/Bundle/Resources/config/v3/metadata.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
<service id="api_platform.metadata.property.metadata_factory" alias="api_platform.metadata.property.metadata_factory.xml" />
66
<service id="ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface" alias="api_platform.metadata.property.metadata_factory" />
77

8+
<service id="api_platform.metadata.resource.name_collection_factory.attributes" decorates="api_platform.metadata.resource.name_collection_factory" class="ApiPlatform\Metadata\Resource\Factory\AttributesResourceNameCollectionFactory" public="false">
9+
<argument>%api_platform.resource_class_directories%</argument>
10+
<argument type="service" id="api_platform.metadata.resource.name_collection_factory.attributes.inner" />
11+
</service>
12+
13+
814
</services>
915
</container>

tests/Fixtures/TestBundle/Entity/PaginationEntity.php

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,34 @@
1818
use ApiPlatform\Metadata\GetCollection;
1919
use Doctrine\ORM\Mapping as ORM;
2020

21-
if (\PHP_VERSION_ID > 8000) {
21+
/**
22+
* ProviderEntity.
23+
*
24+
* @ORM\Entity
25+
*/
26+
#[ApiResource]
27+
#[Get]
28+
#[GetCollection(
29+
paginationClientItemsPerPage: true,
30+
paginationItemsPerPage: 5,
31+
paginationMaximumItemsPerPage: 30
32+
)]
33+
class PaginationEntity
34+
{
2235
/**
23-
* ProviderEntity.
24-
*
25-
* @ORM\Entity
26-
*/
27-
#[ApiResource]
28-
#[Get]
29-
#[GetCollection(
30-
paginationClientItemsPerPage: true,
31-
paginationItemsPerPage: 5,
32-
paginationMaximumItemsPerPage: 30
33-
)]
34-
class PaginationEntity
35-
{
36-
/**
37-
* @var int|null
38-
*
39-
* @ORM\Column(type="integer", nullable=true)
40-
* @ORM\Id
41-
* @ORM\GeneratedValue(strategy="AUTO")
42-
*/
43-
private $id;
36+
* @var int|null
37+
*
38+
* @ORM\Column(type="integer", nullable=true)
39+
* @ORM\Id
40+
* @ORM\GeneratedValue(strategy="AUTO")
41+
*/
42+
private $id;
4443

45-
/**
46-
* @return int
47-
*/
48-
public function getId(): ?int
49-
{
50-
return $this->id;
51-
}
44+
/**
45+
* @return int
46+
*/
47+
public function getId(): ?int
48+
{
49+
return $this->id;
5250
}
5351
}

0 commit comments

Comments
 (0)