class ConverterPhpcr extends ConverterBase (View source)

Class which converts a Builder tree to a PHPCR Query.

Properties

protected SourceInterface $from from ConverterBase
protected ColumnInterface[] $columns from ConverterBase
protected OrderingInterface[] $orderings from ConverterBase
protected ConstraintInterface $constraint from ConverterBase
protected QueryObjectModelFactoryInterface $qomf
protected ClassMetadataFactory $mdf
protected DocumentManagerInterface $dm
protected ClassMetadata[] $aliasMetadata When document sources are registered we put the document metadata here.
protected TranslationStrategyInterface[] $translator When document sources are registered we put the translator here in case the document is translatable.
protected SourceDocument[] $sourceDocumentNodes Ugly: We need to store the document source types so that we can append constraints to match the phpcr:class and phpcr:classparents later on.
protected array $aliasWithTranslatedFields Used to keep track of which sources are used with translated fields, to tell the translation strategy to update if needed.
protected string|null $locale

Methods

array
getPhpcrProperty(string $originalAlias, string $odmField)

Return the PHPCR property name and alias for the given ODM document property name and query alias.

walkSourceDocument(SourceDocument $node)

Walk the source document.

walkOperandDynamicField(OperandDynamicField $node)

Walk the dynamic field.

QueryObjectModelFactoryInterface
qomf()

Return the query object model factory.

string
validateAlias(string $alias)

Check that the given alias is valid and return it.

dispatchMany(array $nodes)

Convenience method to dispatch an array of nodes.

object
dispatch(AbstractNode $node)

Dispatch a node.

walkSelect(AbstractNode $node)

No description

walkSelectAdd(SelectAdd $node)

No description

walkFrom(AbstractNode $node)

No description

walkWhere(Where $where)

No description

walkWhereAnd(WhereAnd $whereAnd)

No description

walkWhereOr(WhereOr $whereOr)

No description

walkSourceJoin(SourceJoin $node)

No description

walkSourceJoinLeft(SourceJoinLeft $node)

No description

walkSourceJoinRight(SourceJoinRight $node)

No description

doWalkConstraintComposite(AbstractNode $node, $method)

No description

walkConstraintAndX(ConstraintAndX $node)

No description

walkConstraintOrX(ConstraintOrX $node)

No description

walkConstraintSame(ConstraintSame $node)

No description

walkConstraintChild(ConstraintChild $node)

No description

walkConstraintNot(ConstraintNot $node)

No description

walkOrderBy(OrderBy $node)

No description

walkOrderByAdd(OrderBy $node)

No description

__construct(DocumentManagerInterface $dm, QueryObjectModelFactoryInterface $qomf)

No description

QueryInterface
getQuery(QueryBuilder $builder)

Returns an ODM Query object from the given ODM (query) Builder.

Details

protected array getPhpcrProperty(string $originalAlias, string $odmField)

Return the PHPCR property name and alias for the given ODM document property name and query alias.

The alias might change if this is a translated field and the strategy needs to do a join to get in the translation.

Parameters

string $originalAlias As specified in the query source.
string $odmField Name of ODM document property.

Return Value

array first element is the real alias to use, second element is the property name

Exceptions

Exception If a field used in the query does not exist on the document.

protected walkSourceDocument(SourceDocument $node)

Walk the source document.

Parameters

SourceDocument $node

protected walkOperandDynamicField(OperandDynamicField $node)

Walk the dynamic field.

Implementations should map their domain field name to the PHPCR field name here.

Parameters

OperandDynamicField $node

protected QueryObjectModelFactoryInterface qomf()

Return the query object model factory.

Return Value

QueryObjectModelFactoryInterface

protected string validateAlias(string $alias)

Check that the given alias is valid and return it.

This should only be called from the getQuery function AFTER the document sources are known.

Parameters

string $alias Alias to validate and return

Return Value

string Return the alias to allow this function to be used inline

Exceptions

InvalidArgumentException

protected dispatchMany(array $nodes)

Convenience method to dispatch an array of nodes.

Parameters

array $nodes

object dispatch(AbstractNode $node)

Dispatch a node.

This method will look for a method of the form "walk{NodeType}" in this class and then use that to build the PHPCR QOM counterpart of the given node.

Parameters

AbstractNode $node

Return Value

object
  • PHPCR QOM object

walkSelect(AbstractNode $node)

Parameters

AbstractNode $node

walkSelectAdd(SelectAdd $node)

Parameters

SelectAdd $node

walkFrom(AbstractNode $node)

Parameters

AbstractNode $node

walkWhere(Where $where)

Parameters

Where $where

walkWhereAnd(WhereAnd $whereAnd)

Parameters

WhereAnd $whereAnd

walkWhereOr(WhereOr $whereOr)

Parameters

WhereOr $whereOr

protected walkSourceJoin(SourceJoin $node)

Parameters

SourceJoin $node

protected walkSourceJoinLeft(SourceJoinLeft $node)

Parameters

SourceJoinLeft $node

protected walkSourceJoinRight(SourceJoinRight $node)

Parameters

SourceJoinRight $node

protected walkSourceJoinConditionFactory(SourceJoinConditionFactory $node)

Parameters

SourceJoinConditionFactory $node

protected walkSourceJoinConditionEqui(SourceJoinConditionEqui $node)

Parameters

SourceJoinConditionEqui $node

protected walkSourceJoinConditionDescendant(SourceJoinConditionDescendant $node)

protected walkSourceJoinConditionChildDocument(SourceJoinConditionChildDocument $node)

protected walkSourceJoinConditionSameDocument(SourceJoinConditionSameDocument $node)

protected doWalkConstraintComposite(AbstractNode $node, $method)

Parameters

AbstractNode $node
$method

protected walkConstraintAndX(ConstraintAndX $node)

Parameters

ConstraintAndX $node

protected walkConstraintOrX(ConstraintOrX $node)

Parameters

ConstraintOrX $node

protected walkConstraintFieldIsset(ConstraintFieldIsset $node)

Parameters

ConstraintFieldIsset $node

protected walkConstraintFullTextSearch(ConstraintFullTextSearch $node)

Parameters

ConstraintFullTextSearch $node

protected walkConstraintSame(ConstraintSame $node)

Parameters

ConstraintSame $node

protected walkConstraintDescendant(ConstraintDescendant $node)

Parameters

ConstraintDescendant $node

protected walkConstraintChild(ConstraintChild $node)

Parameters

ConstraintChild $node

protected walkConstraintComparison(ConstraintComparison $node)

Parameters

ConstraintComparison $node

protected walkConstraintNot(ConstraintNot $node)

Parameters

ConstraintNot $node

protected walkOperandDynamicLocalName(OperandDynamicLocalName $node)

Parameters

OperandDynamicLocalName $node

protected walkOperandDynamicFullTextSearchScore(OperandDynamicFullTextSearchScore $node)

protected walkOperandDynamicLength(OperandDynamicLength $node)

Parameters

OperandDynamicLength $node

protected walkOperandDynamicName(OperandDynamicName $node)

Parameters

OperandDynamicName $node

protected walkOperandDynamicLowerCase(OperandDynamicLowerCase $node)

Parameters

OperandDynamicLowerCase $node

protected walkOperandDynamicUpperCase(OperandDynamicUpperCase $node)

Parameters

OperandDynamicUpperCase $node

protected walkOperandStaticLiteral(OperandStaticLiteral $node)

Parameters

OperandStaticLiteral $node

protected walkOperandStaticParameter(OperandStaticParameter $node)

Parameters

OperandStaticParameter $node

protected walkOrderBy(OrderBy $node)

Parameters

OrderBy $node

protected walkOrderByAdd(OrderBy $node)

Parameters

OrderBy $node

__construct(DocumentManagerInterface $dm, QueryObjectModelFactoryInterface $qomf)

Parameters

DocumentManagerInterface $dm
QueryObjectModelFactoryInterface $qomf

QueryInterface getQuery(QueryBuilder $builder)

Returns an ODM Query object from the given ODM (query) Builder.

Dispatches the From, Select, Where and OrderBy nodes. Each of these "root" nodes append or set PHPCR QOM objects to corresponding properties in this class, which are subsequently used to create a PHPCR QOM object which is embedded in an ODM Query object.

Parameters

QueryBuilder $builder

Return Value

QueryInterface