PHP Class ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractFilter

Abstract class with helpers for easing the implementation of a filter.
Author: Kévin Dunglas ([email protected])
Author: Théo FIDRY ([email protected])
Inheritance: implements ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\FilterInterface
Afficher le fichier Open project: api-platform/core Class Usage Examples

Protected Properties

Свойство Type Description
$logger
$managerRegistry
$properties
$requestStack

Méthodes publiques

Méthode Description
__construct ( Doctrine\Common\Persistence\ManagerRegistry $managerRegistry, Symfony\Component\HttpFoundation\RequestStack $requestStack, Psr\Log\LoggerInterface $logger = null, array $properties = null )
apply ( Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null )

Méthodes protégées

Méthode Description
addJoinOnce ( Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $association ) : string Adds a join to the queryBuilder if none exists.
addJoinsForNestedProperty ( string $property, string $rootAlias, Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator ) : array Adds the necessary joins for a nested property.
extractProperties ( Request $request ) : array Extracts properties to filter from the request.
filterProperty ( string $property, mixed $value, Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null ) Passes a property through the filter.
getClassMetadata ( string $resourceClass ) : Doctrine\Common\Persistence\Mapping\ClassMetadata Gets class metadata for the given resource.
getNestedMetadata ( string $resourceClass, array $associations ) : Doctrine\Common\Persistence\Mapping\ClassMetadata Gets nested class metadata for the given resource.
isPropertyEnabled ( string $property ) : boolean Determines whether the given property is enabled.
isPropertyMapped ( string $property, string $resourceClass, boolean $allowAssociation = false ) : boolean Determines whether the given property is mapped.
isPropertyNested ( string $property ) : boolean Determines whether the given property is nested.
splitPropertyParts ( string $property ) : array Splits the given property into parts.

Private Methods

Méthode Description
getExistingJoin ( Doctrine\ORM\QueryBuilder $queryBuilder, string $alias, string $association ) : Doctrine\ORM\Query\Expr\Join | null Get the existing join from queryBuilder DQL parts.

Method Details

__construct() public méthode

public __construct ( Doctrine\Common\Persistence\ManagerRegistry $managerRegistry, Symfony\Component\HttpFoundation\RequestStack $requestStack, Psr\Log\LoggerInterface $logger = null, array $properties = null )
$managerRegistry Doctrine\Common\Persistence\ManagerRegistry
$requestStack Symfony\Component\HttpFoundation\RequestStack
$logger Psr\Log\LoggerInterface
$properties array

addJoinOnce() protected méthode

Adds a join to the queryBuilder if none exists.
protected addJoinOnce ( Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $association ) : string
$queryBuilder Doctrine\ORM\QueryBuilder
$queryNameGenerator ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface
$alias string
$association string the association field
Résultat string the new association alias

addJoinsForNestedProperty() protected méthode

Adds the necessary joins for a nested property.
protected addJoinsForNestedProperty ( string $property, string $rootAlias, Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator ) : array
$property string
$rootAlias string
$queryBuilder Doctrine\ORM\QueryBuilder
$queryNameGenerator ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface
Résultat array An array where the first element is the join $alias of the leaf entity, the second element is the $field name the third element is the $associations array

apply() public méthode

public apply ( Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null )
$queryBuilder Doctrine\ORM\QueryBuilder
$queryNameGenerator ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface
$resourceClass string
$operationName string

extractProperties() protected méthode

Extracts properties to filter from the request.
protected extractProperties ( Request $request ) : array
$request Symfony\Component\HttpFoundation\Request
Résultat array

filterProperty() abstract protected méthode

Passes a property through the filter.
abstract protected filterProperty ( string $property, mixed $value, Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null )
$property string
$value mixed
$queryBuilder Doctrine\ORM\QueryBuilder
$queryNameGenerator ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface
$resourceClass string
$operationName string

getClassMetadata() protected méthode

Gets class metadata for the given resource.
protected getClassMetadata ( string $resourceClass ) : Doctrine\Common\Persistence\Mapping\ClassMetadata
$resourceClass string
Résultat Doctrine\Common\Persistence\Mapping\ClassMetadata

getNestedMetadata() protected méthode

Gets nested class metadata for the given resource.
protected getNestedMetadata ( string $resourceClass, array $associations ) : Doctrine\Common\Persistence\Mapping\ClassMetadata
$resourceClass string
$associations array
Résultat Doctrine\Common\Persistence\Mapping\ClassMetadata

isPropertyEnabled() protected méthode

Determines whether the given property is enabled.
protected isPropertyEnabled ( string $property ) : boolean
$property string
Résultat boolean

isPropertyMapped() protected méthode

Determines whether the given property is mapped.
protected isPropertyMapped ( string $property, string $resourceClass, boolean $allowAssociation = false ) : boolean
$property string
$resourceClass string
$allowAssociation boolean
Résultat boolean

isPropertyNested() protected méthode

Determines whether the given property is nested.
protected isPropertyNested ( string $property ) : boolean
$property string
Résultat boolean

splitPropertyParts() protected méthode

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 ) : array
$property string
Résultat array

Property Details

$logger protected_oe property

protected $logger

$managerRegistry protected_oe property

protected $managerRegistry

$properties protected_oe property

protected $properties

$requestStack protected_oe property

protected $requestStack