References OrderExtension
Reference
C
Class

ApiPlatform\Doctrine\Odm\Extension\OrderExtension

Applies selected ordering while querying resource collection.

class ApiPlatform\Doctrine\Odm\Extension\OrderExtension implements ApiPlatform\Doctrine\Odm\Extension\AggregationCollectionExtensionInterface
{
    public __construct(null|string $order, null|Doctrine\Persistence\ManagerRegistry $managerRegistry)
    public applyToCollection(Doctrine\ODM\MongoDB\Aggregation\Builder $aggregationBuilder, string $resourceClass, null|ApiPlatform\Metadata\Operation $operation, array $context): null
    protected getManagerRegistry(): Doctrine\Persistence\ManagerRegistry
    protected splitPropertyParts(string $property, string $resourceClass): array
    protected getClassMetadata(string $resourceClass): Doctrine\Persistence\Mapping\ClassMetadata
    protected addLookupsForNestedProperty(string $property, Doctrine\ODM\MongoDB\Aggregation\Builder $aggregationBuilder, string $resourceClass, bool $preserveNullAndEmptyArrays): array
    protected isPropertyMapped(string $property, string $resourceClass, bool $allowAssociation): bool
    protected isPropertyNested(string $property, string $resourceClass): bool
    protected isPropertyEmbedded(string $property, string $resourceClass): bool
    protected getDoctrineFieldType(string $property, string $resourceClass): string
    protected getNestedMetadata(string $resourceClass, array<int, string> $associations): Doctrine\Persistence\Mapping\ClassMetadata
}

Methods

__construct

public __construct(null|string $order, null|Doctrine\Persistence\ManagerRegistry $managerRegistry)

Parameters

orderstring
managerRegistryDoctrine\Persistence\ManagerRegistry

applyToCollection

public applyToCollection(Doctrine\ODM\MongoDB\Aggregation\Builder $aggregationBuilder, string $resourceClass, null|ApiPlatform\Metadata\Operation $operation, array $context): null

Parameters

aggregationBuilderDoctrine\ODM\MongoDB\Aggregation\Builder
resourceClassstring
operation`ApiPlatform\Metadata\Operation`
contextarray

Returns

null

getManagerRegistry

protected getManagerRegistry(): Doctrine\Persistence\ManagerRegistry

Returns

Doctrine\Persistence\ManagerRegistry

splitPropertyParts

Splits the given property into parts.Returns an array with the following keys:

  • associations: array of associations according to nesting order
  • field: string holding the actual field (leaf node)
protected splitPropertyParts(string $property, string $resourceClass): array

Parameters

propertystring
resourceClassstring

Returns

array

getClassMetadata

Gets class metadata for the given resource.

protected getClassMetadata(string $resourceClass): Doctrine\Persistence\Mapping\ClassMetadata

Parameters

resourceClassstring

Returns

Doctrine\Persistence\Mapping\ClassMetadata

addLookupsForNestedProperty

Adds the necessary lookups for a nested property.

protected addLookupsForNestedProperty(string $property, Doctrine\ODM\MongoDB\Aggregation\Builder $aggregationBuilder, string $resourceClass, bool $preserveNullAndEmptyArrays): array

Parameters

propertystring
aggregationBuilderDoctrine\ODM\MongoDB\Aggregation\Builder
resourceClassstring
preserveNullAndEmptyArraysbool

Returns

array

isPropertyMapped

Determines whether the given property is mapped.

protected isPropertyMapped(string $property, string $resourceClass, bool $allowAssociation): bool

Parameters

propertystring
resourceClassstring
allowAssociationbool

Returns

bool

isPropertyNested

Determines whether the given property is nested.

protected isPropertyNested(string $property, string $resourceClass): bool

Parameters

propertystring
resourceClassstring

Returns

bool

isPropertyEmbedded

Determines whether the given property is embedded.

protected isPropertyEmbedded(string $property, string $resourceClass): bool

Parameters

propertystring
resourceClassstring

Returns

bool

getDoctrineFieldType

Gets the Doctrine Type of a given property/resourceClass.

protected getDoctrineFieldType(string $property, string $resourceClass): string

Parameters

propertystring
resourceClassstring

Returns

string

getNestedMetadata

Gets nested class metadata for the given resource.

protected getNestedMetadata(string $resourceClass, array<int, string> $associations): Doctrine\Persistence\Mapping\ClassMetadata

Parameters

resourceClassstring
associationsarray<int, string>

Returns

Doctrine\Persistence\Mapping\ClassMetadata

Made with love by

Les-Tilleuls.coop can help you design and develop your APIs and web projects, and train your teams in API Platform, Symfony, Next.js, Kubernetes and a wide range of other technologies.

Learn more

Copyright © 2023 Kévin Dunglas

Sponsored by Les-Tilleuls.coop