-
-
Notifications
You must be signed in to change notification settings - Fork 865
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
2 changed files
with
97 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
54 changes: 54 additions & 0 deletions
54
tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnlyRelationSecondLevel.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,54 @@ | ||
<?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\Document; | ||
|
||
use ApiPlatform\Metadata\GetCollection; | ||
use ApiPlatform\Metadata\Link; | ||
use ApiPlatform\Metadata\Post; | ||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | ||
|
||
#[ | ||
Post, | ||
GetCollection(uriTemplate: '/property-collection-relation-second-levels'), | ||
GetCollection( | ||
uriTemplate: '/property_collection_iri_only_relations/{parentId}/children', | ||
uriVariables: [ | ||
'parentId' => new Link(toProperty: 'parent', fromClass: PropertyCollectionIriOnlyRelation::class), | ||
] | ||
) | ||
] | ||
#[ODM\Document] | ||
class PropertyCollectionIriOnlyRelationSecondLevel | ||
{ | ||
#[ODM\Id(strategy: 'INCREMENT', type: 'int')] | ||
private ?int $id = null; | ||
|
||
#[ODM\ReferenceOne(targetDocument: PropertyCollectionIriOnlyRelation::class)] | ||
private ?PropertyCollectionIriOnly $parent = null; | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id ?? 9999; | ||
} | ||
|
||
public function getParent(): ?PropertyCollectionIriOnlyRelation | ||
{ | ||
return $this->parent; | ||
Check failure on line 47 in tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnlyRelationSecondLevel.php GitHub Actions / PHPStan (PHP 8.3)
|
||
} | ||
|
||
public function setParent(?PropertyCollectionIriOnlyRelation $parent): void | ||
{ | ||
$this->parent = $parent; | ||
Check failure on line 52 in tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnlyRelationSecondLevel.php GitHub Actions / PHPStan (PHP 8.3)
|
||
} | ||
} |