-
-
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(jsonapi): re-add continue once relation is determined (#6325)
- Loading branch information
1 parent
97c8ae2
commit fce42e0
Showing
5 changed files
with
181 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?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\Metadata\ApiProperty; | ||
use ApiPlatform\Metadata\ApiResource; | ||
|
||
#[ApiResource] | ||
class Animal | ||
{ | ||
private ?int $id = null; | ||
|
||
#[ApiProperty(required: true)] | ||
private ?Species $species = null; | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getSpecies(): ?Species | ||
{ | ||
return $this->species; | ||
} | ||
|
||
public function setSpecies(?Species $species): static | ||
{ | ||
$this->species = $species; | ||
|
||
return $this; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
tests/Fixtures/TestBundle/ApiResource/AnimalObservation.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,60 @@ | ||
<?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\Metadata\ApiProperty; | ||
use ApiPlatform\Metadata\ApiResource; | ||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
|
||
#[ApiResource] | ||
class AnimalObservation | ||
{ | ||
private ?int $id = null; | ||
|
||
#[ApiProperty(required: true)] | ||
private Collection $individuals; | ||
|
||
public function __construct() | ||
{ | ||
$this->individuals = new ArrayCollection(); | ||
} | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** @return Collection<int, Animal> */ | ||
public function getIndividuals(): Collection | ||
{ | ||
return $this->individuals; | ||
} | ||
|
||
public function addIndividual(Animal $individual): static | ||
{ | ||
if (!$this->individuals->contains($individual)) { | ||
$this->individuals->add($individual); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
public function removeIndividual(Animal $individual): static | ||
{ | ||
$this->individuals->removeElement($individual); | ||
|
||
return $this; | ||
} | ||
} |
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,38 @@ | ||
<?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\Metadata\ApiProperty; | ||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\Get; | ||
use ApiPlatform\Metadata\GetCollection; | ||
|
||
#[ApiResource] | ||
#[GetCollection( | ||
uriTemplate: '/species', | ||
)] | ||
#[Get( | ||
uriTemplate: '/species/{key}', | ||
)] | ||
final class Species | ||
{ | ||
#[ApiProperty(identifier: true)] | ||
public ?int $key = null; | ||
public ?string $kingdom = null; | ||
public ?string $phylum = null; | ||
public ?string $order = null; | ||
public ?string $family = null; | ||
public ?string $genus = null; | ||
public ?string $species = null; | ||
} |
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