adt/query-utils

This package is abandoned and no longer maintained. No replacement package was suggested.

Doctrine query helpers for ADT.

v2.1.1 2019-02-04 13:44 UTC

This package is auto-updated.

Last update: 2022-07-04 21:01:51 UTC


README

Set of Doctrine ORM query helpers.

Prepared Queries

All predefined queries share common ancestor: Query\BaseQuery. This class exposes these public methods:

  1. bindExprTo($qb) - binds generated expression to your QueryBuilder,
  2. bindParametersTo($qb) - binds generated parameters to your QueryBuilder,
  3. bindTo($qb) - binds expression and parameters to your QueryBuilder.

Also, bindExprTo and bindTo have second, optional parameter $method which defaults to and. This represents method used for binding.

  1. if and is passed, $qb->andWhere(...) is used,
  2. if or is passed, $qb->orWhere(...) is used.

Full-text Query

For string $q to lookup on columns client.firstName and client.lastName use following:

long form:

$helper = new \ADT\QueryUtils\Query\FullTextQuery($q, [
    'client.firstName', 'client.lastName'
]);
 
$helper->bindTo($queryBuilder);

or short form:

\ADT\QueryUtils\Query\FullTextQuery::create($q, [
    'client.firstName', 'client.lastName'
])->bindTo($queryBuilder);