forked from api-platform/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserActionResourceOdm.php
More file actions
51 lines (46 loc) · 1.49 KB
/
Copy pathUserActionResourceOdm.php
File metadata and controls
51 lines (46 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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\Issue7916;
use ApiPlatform\Doctrine\Odm\Filter\PartialSearchFilter;
use ApiPlatform\Doctrine\Odm\State\Options;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\QueryParameter;
use ApiPlatform\Tests\Fixtures\TestBundle\Document\Issue7916\UserAction;
/**
* API Resource DTO for MongoDB UserAction using stateOptions pattern.
* This is a separate API Resource for the UserAction document which is NOT itself marked #[ApiResource].
*
* @see https://github.com/api-platform/core/issues/7916
*/
#[ApiResource(
operations: [
new GetCollection(
uriTemplate: '/user-actions',
parameters: [
'name' => new QueryParameter(
filter: new PartialSearchFilter(),
property: 'user.name',
),
'email' => new QueryParameter(
filter: new PartialSearchFilter(),
property: 'user.email',
),
],
),
],
stateOptions: new Options(documentClass: UserAction::class),
)]
class UserActionResourceOdm
{
public ?int $id = null;
public ?string $action = null;
}