-
-
Notifications
You must be signed in to change notification settings - Fork 874
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
230 additions
and
76 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
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
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
36 changes: 36 additions & 0 deletions
36
tests/Fixtures/TestBundle/ApiResource/FilterWithStateOptions.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,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* 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\Doctrine\Orm\Filter\DateFilter; | ||
use ApiPlatform\Doctrine\Orm\State\CollectionProvider; | ||
use ApiPlatform\Doctrine\Orm\State\Options; | ||
use ApiPlatform\Metadata\ApiFilter; | ||
use ApiPlatform\Metadata\GetCollection; | ||
use ApiPlatform\Metadata\QueryParameter; | ||
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\FilterWithStateOptionsEntity; | ||
|
||
#[GetCollection( | ||
uriTemplate: 'filter_with_state_options', | ||
stateOptions: new Options(entityClass: FilterWithStateOptionsEntity::class), | ||
parameters: ['date' => new QueryParameter(filter: 'filter_with_state_options_date', property: 'dummyDate')], | ||
provider: CollectionProvider::class | ||
)] | ||
#[ApiFilter(DateFilter::class, alias: 'filter_with_state_options_date', properties: ['dummyDate' => DateFilter::EXCLUDE_NULL])] | ||
final class FilterWithStateOptions | ||
{ | ||
public function __construct(public readonly string $id, public readonly \DateTimeImmutable $dummyDate, public readonly string $name) | ||
{ | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
tests/Fixtures/TestBundle/Entity/FilterWithStateOptionsEntity.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 <[email protected]> | ||
* | ||
* 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\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ORM\Entity] | ||
class FilterWithStateOptionsEntity | ||
{ | ||
public function __construct( | ||
#[ORM\Column(type: 'integer')] | ||
#[ORM\Id] | ||
#[ORM\GeneratedValue(strategy: 'AUTO')] | ||
public ?int $id = null, | ||
#[ORM\Column(type: 'date_immutable', nullable: true)] | ||
public ?\DateTimeImmutable $dummyDate = null, | ||
#[ORM\Column(type: 'string', nullable: true)] | ||
public ?string $name = null, | ||
) { | ||
} | ||
} |
Oops, something went wrong.