Reference
T
Trait

ApiPlatform\Doctrine\Common\Filter\SearchFilterTrait

Trait for filtering the collection by given properties.

trait ApiPlatform\Doctrine\Common\Filter\SearchFilterTrait
{
    public getDescription(string $resourceClass): array
    protected getType(string $doctrineType): string
    protected getProperties(): array
    protected getLogger(): Psr\Log\LoggerInterface
    protected getIriConverter(): ApiPlatform\Api\IriConverterInterface
    protected getPropertyAccessor(): Symfony\Component\PropertyAccess\PropertyAccessorInterface
    protected normalizePropertyName(string $property): string
    protected getIdFromValue(string $value)
    protected normalizeValues(array $values, string $property): array
    protected hasValidValues(array $values, null|string $type): bool
    protected getManagerRegistry(): Doctrine\Persistence\ManagerRegistry
    protected isPropertyMapped(string $property, string $resourceClass, bool $allowAssociation): bool
    protected isPropertyNested(string $property, string $resourceClass): bool
    protected isPropertyEmbedded(string $property, string $resourceClass): bool
    protected splitPropertyParts(string $property, string $resourceClass): array
    protected getDoctrineFieldType(string $property, string $resourceClass): string
    protected getNestedMetadata(string $resourceClass, array<int, string> $associations): Doctrine\Persistence\Mapping\ClassMetadata
    protected getClassMetadata(string $resourceClass): Doctrine\Persistence\Mapping\ClassMetadata
}
trait ApiPlatform\Doctrine\Common\Filter\SearchFilterTrait
{
    public getDescription(string $resourceClass): array
    protected getType(string $doctrineType): string
    protected getProperties(): array
    protected getLogger(): Psr\Log\LoggerInterface
    protected getIriConverter(): ApiPlatform\Api\IriConverterInterface
    protected getPropertyAccessor(): Symfony\Component\PropertyAccess\PropertyAccessorInterface
    protected normalizePropertyName(string $property): string
    protected getIdFromValue(string $value)
    protected normalizeValues(array $values, string $property): array
    protected hasValidValues(array $values, null|string $type): bool
    protected getManagerRegistry(): Doctrine\Persistence\ManagerRegistry
    protected isPropertyMapped(string $property, string $resourceClass, bool $allowAssociation): bool
    protected isPropertyNested(string $property, string $resourceClass): bool
    protected isPropertyEmbedded(string $property, string $resourceClass): bool
    protected splitPropertyParts(string $property, string $resourceClass): array
    protected getDoctrineFieldType(string $property, string $resourceClass): string
    protected getNestedMetadata(string $resourceClass, array<int, string> $associations): Doctrine\Persistence\Mapping\ClassMetadata
    protected getClassMetadata(string $resourceClass): Doctrine\Persistence\Mapping\ClassMetadata
}

Properties

iriConverter

ApiPlatform\Api\IriConverterInterface $iriConverter
ApiPlatform\Api\IriConverterInterface $iriConverter

propertyAccessor

Symfony\Component\PropertyAccess\PropertyAccessorInterface $propertyAccessor
Symfony\Component\PropertyAccess\PropertyAccessorInterface $propertyAccessor

identifiersExtractor

ApiPlatform\Api\IdentifiersExtractorInterface $identifiersExtractor
ApiPlatform\Api\IdentifiersExtractorInterface $identifiersExtractor

Methods

getDescription

public getDescription(string $resourceClass): array
public getDescription(string $resourceClass): array

Parameters

resourceClassstring

Returns

array

getType

Converts a Doctrine type in PHP type.

protected getType(string $doctrineType): string
protected getType(string $doctrineType): string

Parameters

doctrineTypestring

Returns

string

getProperties

protected getProperties(): array
protected getProperties(): array

Returns

array

getLogger

protected getLogger(): Psr\Log\LoggerInterface
protected getLogger(): Psr\Log\LoggerInterface

Returns

Psr\Log\LoggerInterface

getIriConverter

protected getIriConverter(): ApiPlatform\Api\IriConverterInterface
protected getIriConverter(): ApiPlatform\Api\IriConverterInterface

Returns

ApiPlatform\Api\IriConverterInterface

getPropertyAccessor

protected getPropertyAccessor(): Symfony\Component\PropertyAccess\PropertyAccessorInterface
protected getPropertyAccessor(): Symfony\Component\PropertyAccess\PropertyAccessorInterface

Returns

Symfony\Component\PropertyAccess\PropertyAccessorInterface

normalizePropertyName

protected normalizePropertyName(string $property): string
protected normalizePropertyName(string $property): string

Parameters

propertystring

Returns

string

getIdFromValue

Gets the ID from an IRI or a raw ID.

protected getIdFromValue(string $value)
protected getIdFromValue(string $value)

Parameters

valuestring

Returns

normalizeValues

Normalize the values array.

protected normalizeValues(array $values, string $property): array
protected normalizeValues(array $values, string $property): array

Parameters

valuesarray
propertystring

Returns

array

hasValidValues

When the field should be an integer, check that the given value is a valid one.

protected hasValidValues(array $values, null|string $type): bool
protected hasValidValues(array $values, null|string $type): bool

Parameters

valuesarray
typestring

Returns

bool

getManagerRegistry

protected getManagerRegistry(): Doctrine\Persistence\ManagerRegistry
protected getManagerRegistry(): Doctrine\Persistence\ManagerRegistry

Returns

Doctrine\Persistence\ManagerRegistry

isPropertyMapped

Determines whether the given property is mapped.

protected isPropertyMapped(string $property, string $resourceClass, bool $allowAssociation): bool
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
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
protected isPropertyEmbedded(string $property, string $resourceClass): bool

Parameters

propertystring
resourceClassstring

Returns

bool

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
protected splitPropertyParts(string $property, string $resourceClass): array

Parameters

propertystring
resourceClassstring

Returns

array

getDoctrineFieldType

Gets the Doctrine Type of a given property/resourceClass.

protected getDoctrineFieldType(string $property, string $resourceClass): string
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
protected getNestedMetadata(string $resourceClass, array<int, string> $associations): Doctrine\Persistence\Mapping\ClassMetadata

Parameters

resourceClassstring
associationsarray<int, string>

Returns

Doctrine\Persistence\Mapping\ClassMetadata

getClassMetadata

Gets class metadata for the given resource.

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

Parameters

resourceClassstring

Returns

Doctrine\Persistence\Mapping\ClassMetadata

Copyright © 2023 Kévin Dunglas

Sponsored by Les-Tilleuls.coop