Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(symfony): allow post with uri variables and no provider
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/Fixtures/TestBundle/ApiResource/PostWithUriVariables.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource; | ||
|
||
use ApiPlatform\Metadata\NotExposed; | ||
use ApiPlatform\Metadata\Operation; | ||
use ApiPlatform\Metadata\Post; | ||
|
||
#[NotExposed(uriTemplate: '/post_with_uri_variables/{id}')] | ||
#[Post(uriTemplate: '/post_with_uri_variables/{id}', uriVariables: ['id'], processor: [PostWithUriVariables::class, 'process'])] | ||
final class PostWithUriVariables | ||
{ | ||
public function __construct(public readonly ?int $id = null) | ||
{ | ||
} | ||
|
||
public static function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []) | ||
{ | ||
return new self(id: 1); | ||
} | ||
} |