Skip to content

Conversation

@loic425
Copy link
Contributor

@loic425 loic425 commented Jun 13, 2025

Q A
Branch? main
Tickets
License MIT
Doc PR api-platform/docs#...

The idea of this feature is to allow customizing built-in endpoints from a third party API (ex Sylius E-commerce API).

<?php

declare(strict_types=1);

use ApiPlatform\Metadata\Put;
use App\Entity\Speaker;
use ApiPlatform\Metadata\ApiResource;

return static function (ApiResource $resource): ApiResource {
    if (Speaker::class !== $resource->getClass()) {
        return $resource;
    }

    $operations = $resource->getOperations();

    $operations->add('_api_Speaker_put', new Put());
    $operations->remove('_api_Speaker_get_collection');

    return $resource->withOperations($operations)->withShortName('dummy');
};

image

In this example, the get collection operation has been removed and the put has been added (dummies)

@loic425 loic425 marked this pull request as draft June 13, 2025 07:58
@loic425 loic425 force-pushed the fix/php-file-resource-extractor branch 6 times, most recently from 2608d87 to c093d61 Compare June 13, 2025 09:18
@loic425 loic425 force-pushed the fix/php-file-resource-extractor branch from c093d61 to 868ac56 Compare June 13, 2025 09:28
@loic425 loic425 marked this pull request as ready for review June 13, 2025 09:33
@loic425 loic425 closed this Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant