-
-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(graphql): use depth for nested resource class operation (#5314)
* test: add reproducer for bug 5310 * fix(graphql): use depth for nested resource class operation Co-authored-by: Alan Poulain <[email protected]>
- Loading branch information
1 parent
7fce4eb
commit 3d8371a
Showing
4 changed files
with
108 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?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 ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\GraphQl\Query; | ||
use ApiPlatform\Metadata\GraphQl\QueryCollection; | ||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ApiResource(graphQlOperations: [new Query(), new QueryCollection()])] | ||
#[ORM\Entity] | ||
class TreeDummy | ||
{ | ||
#[ORM\Column(type: 'integer', nullable: true)] | ||
#[ORM\Id] | ||
#[ORM\GeneratedValue(strategy: 'AUTO')] | ||
private ?int $id = null; | ||
|
||
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')] | ||
public ?TreeDummy $parent = null; | ||
|
||
/** @var Collection<int, TreeDummy> */ | ||
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')] | ||
public Collection $children; | ||
|
||
public function __construct() | ||
{ | ||
$this->children = new ArrayCollection(); | ||
} | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getParent(): ?self | ||
{ | ||
return $this->parent; | ||
} | ||
|
||
public function setParent(?self $parent): void | ||
{ | ||
$this->parent = $parent; | ||
} | ||
|
||
public function getChildren(): Collection | ||
{ | ||
return $this->children; | ||
} | ||
} |