Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Resource): ability to read/write to a resource alias
- Loading branch information
Showing
21 changed files
with
383 additions
and
67 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
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 <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\Core\Api; | ||
|
||
use ApiPlatform\Core\Exception\RuntimeException; | ||
|
||
/** | ||
* Extracts identifiers for a given Resource according to the retrieved Metadata. | ||
* | ||
* @author Antoine Bluchet <soyuka@gmail.com> | ||
*/ | ||
interface ContextAwareIdentifiersExtractorInterface extends IdentifiersExtractorInterface | ||
{ | ||
/** | ||
* Finds identifiers from a Resource class. | ||
*/ | ||
public function getIdentifiersFromResourceClass(string $resourceClass): array; | ||
|
||
/** | ||
* Finds identifiers from an Item (object). | ||
* | ||
* @param object $item | ||
* | ||
* @throws RuntimeException | ||
*/ | ||
public function getIdentifiersFromItem($item, array $context = []): array; | ||
} |
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,69 @@ | ||
<?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\Core\Api; | ||
|
||
use ApiPlatform\Core\Exception\InvalidArgumentException; | ||
use ApiPlatform\Core\Exception\ItemNotFoundException; | ||
use ApiPlatform\Core\Exception\RuntimeException; | ||
|
||
/** | ||
* Converts item and resources to IRI and vice versa. | ||
* | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
*/ | ||
interface ContextAwareIriConverterInterface extends IriConverterInterface | ||
{ | ||
/** | ||
* Retrieves an item from its IRI. | ||
* | ||
* @throws InvalidArgumentException | ||
* @throws ItemNotFoundException | ||
* | ||
* @return object | ||
*/ | ||
public function getItemFromIri(string $iri, array $context = []); | ||
|
||
/** | ||
* Gets the IRI associated with the given item. | ||
* | ||
* @param object $item | ||
* | ||
* @throws InvalidArgumentException | ||
* @throws RuntimeException | ||
*/ | ||
public function getIriFromItem($item, int $referenceType = UrlGeneratorInterface::ABS_PATH, array $context = []): string; | ||
|
||
/** | ||
* Gets the IRI associated with the given resource collection. | ||
* | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::ABS_PATH): string; | ||
|
||
/** | ||
* Gets the item IRI associated with the given resource. | ||
* | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function getItemIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string; | ||
|
||
/** | ||
* Gets the IRI associated with the given resource subresource. | ||
* | ||
* @deprecated | ||
* | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function getSubresourceIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::ABS_PATH): string; | ||
} |
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
Oops, something went wrong.