Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Action/NotExposedAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/**
* An action which always returns HTTP 404 Not Found with an explanation for why the operation is not exposed.
*
* @deprecated use ApiPlatform\Symfony\Action\NotExposedAction
*/
final class NotExposedAction
{
Expand Down
2 changes: 2 additions & 0 deletions src/Action/NotFoundAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

/**
* An action which always returns HTTP 404 Not Found. Useful for disabling an operation.
*
* @deprecated use ApiPlatform\Symfony\Action\NotFoundAction
*/
final class NotFoundAction
{
Expand Down
2 changes: 2 additions & 0 deletions src/Action/PlaceholderAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Placeholder returning the data passed in parameter.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated use ApiPlatform\Symfony\Action\PlaceholderAction
*/
final class PlaceholderAction
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
use ApiPlatform\Metadata\Operation;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use ApiPlatform\Metadata\Util\Inflector;
use Elasticsearch\Client;
use Elasticsearch\Common\Exceptions\Missing404Exception;
use Elasticsearch\Common\Exceptions\NoNodesAvailableException;

final class ElasticsearchProviderResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface
{
public function __construct(private readonly ?Client $client, private readonly ResourceMetadataCollectionFactoryInterface $decorated, private readonly bool $triggerDeprecation = true, private readonly ?InflectorInterface $inflector = new Inflector()) // @phpstan-ignore-line
public function __construct(private readonly ?Client $client, private readonly ResourceMetadataCollectionFactoryInterface $decorated, private readonly bool $triggerDeprecation = true, private readonly ?InflectorInterface $inflector = null) // @phpstan-ignore-line
{
if ($client) {
trigger_deprecation('api-platform/core', '4.0', sprintf('Using $client at "%s" is deprecated and the argument will be removed.', self::class));
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/DeserializationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*
* @author Samuel ROZE <samuel.roze@gmail.com>
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated
*/
class DeserializationException extends \Exception implements ExceptionInterface, SerializerExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ErrorCodeSerializableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

/**
* An exception which has a serializable application-specific error code.
*
* @deprecated
*/
interface ErrorCodeSerializableInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Base exception interface.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\ExceptionInterface
*/
interface ExceptionInterface extends \Throwable
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Invalid argument exception.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\InvalidArgumentException
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/InvalidIdentifierException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Identifier is not valid exception.
*
* @author Antoine Bluchet <soyuka@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\InvalidIdentifierException
*/
class InvalidIdentifierException extends \Exception implements ExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/InvalidResourceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Invalid resource exception.
*
* @author Paul Le Corre <paul@lecorre.me>
*
* @deprecated
*/
class InvalidResourceException extends \Exception implements ExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/InvalidUriVariableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Identifier is not valid exception.
*
* @author Antoine Bluchet <soyuka@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\InvalidUriVariableException
*/
class InvalidUriVariableException extends \Exception implements ExceptionInterface
{
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/InvalidValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace ApiPlatform\Exception;

/**
* @deprecated
*/
class InvalidValueException extends InvalidArgumentException
{
}
2 changes: 2 additions & 0 deletions src/Exception/ItemNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Item not found exception.
*
* @author Amrouche Hamza <hamza.simperfit@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\ItemNotFoundException
*/
class ItemNotFoundException extends InvalidArgumentException
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/NotExposedHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

/**
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\NotExposedHttpException
*/
class NotExposedHttpException extends NotFoundHttpException
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/OperationNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

/**
* Operation not found exception.
*
* @deprecated use ApiPlatform\Metadata\Exception\OperationNotFoundException
*/
class OperationNotFoundException extends \InvalidArgumentException implements ExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/PropertyNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Property not found exception.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\PropertyNotFoundException
*/
class PropertyNotFoundException extends \Exception implements ExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ResourceClassNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Resource class not found exception.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\ResourceClassNotFoundException
*/
class ResourceClassNotFoundException extends \Exception implements ExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/ResourceClassNotSupportedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/**
* Resource class not supported exception.
*
* @deprecated
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class ResourceClassNotSupportedException extends \Exception implements ExceptionInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Runtime exception.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @deprecated use ApiPlatform\Metadata\Exception\RuntimeException
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Factory/CollectionResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* @author Alan Poulain <contact@alanpoulain.eu>
* @author Kévin Dunglas <dunglas@gmail.com>
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*
* @deprecated
*/
final class CollectionResolverFactory implements ResolverFactoryInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Factory/ItemMutationResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
*
* @author Alan Poulain <contact@alanpoulain.eu>
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*
* @deprecated
*/
final class ItemMutationResolverFactory implements ResolverFactoryInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Factory/ItemResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* @author Alan Poulain <contact@alanpoulain.eu>
* @author Kévin Dunglas <dunglas@gmail.com>
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*
* @deprecated
*/
final class ItemResolverFactory implements ResolverFactoryInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* Creates a function resolving a GraphQL subscription of an item.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
final class ItemSubscriptionResolverFactory implements ResolverFactoryInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/DeserializeStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* Deserialize stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
final class DeserializeStage implements DeserializeStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/DeserializeStageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Deserialize stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
interface DeserializeStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/ReadStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* Read stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
final class ReadStage implements ReadStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/ReadStageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Read stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
interface ReadStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/SecurityPostDenormalizeStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* Security post denormalize stage of GraphQL resolvers.
*
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*
* @deprecated
*/
final class SecurityPostDenormalizeStage implements SecurityPostDenormalizeStageInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* Security post deserialization stage of GraphQL resolvers.
*
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*
* @deprecated
*/
interface SecurityPostDenormalizeStageInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*
* @author Vincent Chalamon <vincentchalamon@gmail.com>
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @deprecated
*/
interface SecurityPostValidationStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/SecurityStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* Security stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
final class SecurityStage implements SecurityStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/SecurityStageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*
* @author Alan Poulain <contact@alanpoulain.eu>
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*
* @deprecated
*/
interface SecurityStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/SerializeStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* Serialize stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
final class SerializeStage implements SerializeStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/SerializeStageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Serialize stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
interface SerializeStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/ValidateStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* Validate stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
final class ValidateStage implements ValidateStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/ValidateStageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* Validate stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
interface ValidateStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/WriteStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* Write stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
final class WriteStage implements WriteStageInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Resolver/Stage/WriteStageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* Write stage of GraphQL resolvers.
*
* @author Alan Poulain <contact@alanpoulain.eu>
*
* @deprecated
*/
interface WriteStageInterface
{
Expand Down
12 changes: 8 additions & 4 deletions src/GraphQl/Subscription/SubscriptionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace ApiPlatform\GraphQl\Subscription;

use ApiPlatform\GraphQl\Resolver\Stage\SerializeStage;
use ApiPlatform\GraphQl\Resolver\Stage\SerializeStageInterface;
use ApiPlatform\GraphQl\Resolver\Util\IdentifierTrait;
use ApiPlatform\Metadata\GraphQl\Operation;
Expand All @@ -37,8 +38,11 @@ final class SubscriptionManager implements OperationAwareSubscriptionManagerInte
use ResourceClassInfoTrait;
use SortTrait;

public function __construct(private readonly CacheItemPoolInterface $subscriptionsCache, private readonly SubscriptionIdentifierGeneratorInterface $subscriptionIdentifierGenerator, private readonly ?SerializeStageInterface $serializeStage, private readonly IriConverterInterface $iriConverter, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ?ProcessorInterface $normalizeProcessor = null)
public function __construct(private readonly CacheItemPoolInterface $subscriptionsCache, private readonly SubscriptionIdentifierGeneratorInterface $subscriptionIdentifierGenerator, private readonly SerializeStageInterface|ProcessorInterface|null $serializeStage = null, private readonly ?IriConverterInterface $iriConverter = null, private readonly ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null)
{
if (!$serializeStage instanceof ProcessorInterface) {
trigger_deprecation('api-platform/core', '4.0', sprintf('Using an instanceof "%s" is deprecated, use "%s" instead.', SerializeStageInterface::class, ProcessorInterface::class));
}
}

public function retrieveSubscriptionId(array $context, ?array $result, ?Operation $operation = null): ?string
Expand Down Expand Up @@ -85,9 +89,9 @@ public function getPushPayloads(object $object): array
$resolverContext = ['fields' => $subscriptionFields, 'is_collection' => false, 'is_mutation' => false, 'is_subscription' => true];
/** @var Operation */
$operation = (new Subscription())->withName('update_subscription')->withShortName($shortName);
if ($this->normalizeProcessor) {
$data = $this->normalizeProcessor->process($object, $operation, [], $resolverContext);
} elseif ($this->serializeStage) {
if ($this->serializeStage instanceof ProcessorInterface) {
$data = $this->serializeStage->process($object, $operation, [], $resolverContext);
} elseif ($this->serializeStage instanceof SerializeStage) {
$data = ($this->serializeStage)($object, $resourceClass, $operation, $resolverContext);
} else {
throw new \LogicException();
Expand Down
Loading