class DocumentRepository extends EntityRepository (View source)

Class DocumentRepository

Constants

NODE_ALIAS

Alias for DQL and Query builder representing Node relation.

NODESSOURCES_ALIAS

Alias for DQL and Query builder representing NodesSources relation.

TRANSLATION_ALIAS

Alias for DQL and Query builder representing Translation relation.

TAG_ALIAS

Alias for DQL and Query builder representing Tag relation.

Properties

protected array $searchableTypes Doctrine column types that can be search with LIKE feature. from EntityRepository

Methods

string
buildComparison(mixed $value, string $prefix, string $key, string $baseKey, QueryBuilder $qb)

Build a query comparison.

QueryBuilder
directComparison(array $criteria, QueryBuilder $qb, string $alias)

Direct bind parameters without preparation.

QueryBuilder
prepareComparisons(array $criteria, QueryBuilder $qb, string $alias)

No description

applyComparisons(array $criteria, Query $finalQuery)

No description

QueryBuilder
singleDirectComparison(string $key, mixed $value, QueryBuilder $qb, string $alias)

Direct bind one single parameter without preparation.

Func
directExprIn(QueryBuilder $qb, string $name, string $key, array $value)

No description

applyComparison(string $key, mixed $value, Query $finalQuery)

Bind classic parameters to your query.

integer
countBy(Criteria|mixed|array $criteria, Translation $translation = null)

Just like the countBy method but with relational criteria.

classicLikeComparison(string $pattern, QueryBuilder $qb, string $alias = "obj")

Create a LIKE comparison with entity texts colunms.

QueryBuilder
createSearchBy(string $pattern, QueryBuilder $qb, array $criteria = [], string $alias = "obj")

Create a Criteria object from a search pattern and additionnal fields.

array|Paginator
searchBy(string $pattern, array $criteria = [], array $orders = [], integer $limit = null, integer $offset = null)

No description

int
countSearchBy(string $pattern, array $criteria = [])

No description

buildTagFiltering(array $criteria, QueryBuilder $qb, string $nodeAlias = 'n')

No description

applyFilterByTag(array $criteria, Query $finalQuery)

Bind tag parameters to final query

boolean
hasJoinedNode(QueryBuilder $qb, string $alias)

Ensure that node table is joined only once.

boolean
hasJoinedNodesSources(QueryBuilder $qb, string $alias)

Ensure that nodes_sources table is joined only once.

mixed|null
findOneByDocumentTranslationId($id)

Get a document with its translation id.

filterByFolder(array $criteria, QueryBuilder $qb)

Add a folder filtering to queryBuilder.

filterByCriteria(array $criteria, QueryBuilder $qb)

Reimplementing findBy features… with extra things

applyFilterByCriteria(array $criteria, Query $finalQuery)

Bind parameters to generated query.

applyFilterByFolder(array $criteria, Query $finalQuery)

Bind tag parameter to final query

applyTranslationByFolder(array $criteria, Query $finalQuery, null $translation = null)

Bind translation parameter to final query

filterByTranslation(array $criteria, QueryBuilder $qb, Translation $translation = null)

Create filters according to any translation criteria OR argument.

QueryBuilder
getContextualQueryWithTranslation(array $criteria, array $orderBy = null, integer|null $limit = null, integer|null $offset = null, Translation $translation = null)

This method allows to pre-filter Documents with a given translation.

QueryBuilder
getCountContextualQueryWithTranslation(array $criteria, Translation $translation = null)

This method allows to pre-filter Documents with a given translation.

array|Paginator
findBy(array $criteria, array $orderBy = null, integer|null $limit = null, integer|null $offset = null, Translation $translation = null)

Just like the findBy method but with relational criteria.

ArrayCollection
findOneBy(array $criteria, array $orderBy = null, Translation $translation = null)

Just like the findOneBy method but with relational criteria.

array
findByNodeSourceAndField(NodesSources $nodeSource, NodeTypeField $field)

No description

array
findByNodeSourceAndFieldName(NodesSources $nodeSource, string $fieldName)

No description

array
findAllSettingDocuments()

Find documents used as Settings.

array
findAllUnused()

Find all unused document.

Details

protected string buildComparison(mixed $value, string $prefix, string $key, string $baseKey, QueryBuilder $qb)

Build a query comparison.

Parameters

mixed $value
string $prefix The prefix should always end with a dot
string $key
string $baseKey
QueryBuilder $qb

Return Value

string

protected QueryBuilder directComparison(array $criteria, QueryBuilder $qb, string $alias)

Direct bind parameters without preparation.

Parameters

array $criteria
QueryBuilder $qb
string $alias

Return Value

QueryBuilder

protected QueryBuilder prepareComparisons(array $criteria, QueryBuilder $qb, string $alias)

Parameters

array $criteria
QueryBuilder $qb
string $alias

Return Value

QueryBuilder

protected applyComparisons(array $criteria, Query $finalQuery)

Parameters

array $criteria
Query $finalQuery

protected QueryBuilder singleDirectComparison(string $key, mixed $value, QueryBuilder $qb, string $alias)

Direct bind one single parameter without preparation.

Parameters

string $key
mixed $value
QueryBuilder $qb
string $alias

Return Value

QueryBuilder

protected Func directExprIn(QueryBuilder $qb, string $name, string $key, array $value)

Parameters

QueryBuilder $qb &$qb
string $name
string $key
array $value

Return Value

Func

protected applyComparison(string $key, mixed $value, Query $finalQuery)

Bind classic parameters to your query.

Parameters

string $key
mixed $value
Query $finalQuery

integer countBy(Criteria|mixed|array $criteria, Translation $translation = null)

Just like the countBy method but with relational criteria.

Parameters

Criteria|mixed|array $criteria or array
Translation $translation

Return Value

integer

protected classicLikeComparison(string $pattern, QueryBuilder $qb, string $alias = "obj")

Create a LIKE comparison with entity texts colunms.

Parameters

string $pattern
QueryBuilder $qb
string $alias

protected QueryBuilder createSearchBy(string $pattern, QueryBuilder $qb, array $criteria = [], string $alias = "obj")

Create a Criteria object from a search pattern and additionnal fields.

Parameters

string $pattern Search pattern
QueryBuilder $qb QueryBuilder to pass
array $criteria Additionnal criteria
string $alias SQL query table alias

Return Value

QueryBuilder

array|Paginator searchBy(string $pattern, array $criteria = [], array $orders = [], integer $limit = null, integer $offset = null)

Parameters

string $pattern Search pattern
array $criteria Additionnal criteria
array $orders
integer $limit
integer $offset

Return Value

array|Paginator

int countSearchBy(string $pattern, array $criteria = [])

Parameters

string $pattern Search pattern
array $criteria Additionnal criteria

Return Value

int

protected buildTagFiltering(array $criteria, QueryBuilder $qb, string $nodeAlias = 'n')

Parameters

array $criteria &$criteria
QueryBuilder $qb
string $nodeAlias

protected applyFilterByTag(array $criteria, Query $finalQuery)

Bind tag parameters to final query

Parameters

array $criteria
Query $finalQuery

protected boolean hasJoinedNode(QueryBuilder $qb, string $alias)

Ensure that node table is joined only once.

Parameters

QueryBuilder $qb
string $alias

Return Value

boolean

protected boolean hasJoinedNodesSources(QueryBuilder $qb, string $alias)

Ensure that nodes_sources table is joined only once.

Parameters

QueryBuilder $qb
string $alias

Return Value

boolean

mixed|null findOneByDocumentTranslationId($id)

Get a document with its translation id.

Parameters

$id

Return Value

mixed|null

protected filterByFolder(array $criteria, QueryBuilder $qb)

Add a folder filtering to queryBuilder.

Parameters

array $criteria
QueryBuilder $qb

protected filterByCriteria(array $criteria, QueryBuilder $qb)

Reimplementing findBy features… with extra things

  • key => array('<=', $value)
  • key => array('<', $value)
  • key => array('>=', $value)
  • key => array('>', $value)
  • key => array('BETWEEN', $value, $value)
  • key => array('LIKE', $value)
  • key => array('NOT IN', $array)
  • key => 'NOT NULL'

You can filter with translations relation, examples:

  • translation => $object
  • translation.locale => 'fr_FR'

Parameters

array $criteria
QueryBuilder $qb

protected applyFilterByCriteria(array $criteria, Query $finalQuery)

Bind parameters to generated query.

Parameters

array $criteria
Query $finalQuery

protected applyFilterByFolder(array $criteria, Query $finalQuery)

Bind tag parameter to final query

Parameters

array $criteria
Query $finalQuery

protected applyTranslationByFolder(array $criteria, Query $finalQuery, null $translation = null)

Bind translation parameter to final query

Parameters

array $criteria
Query $finalQuery
null $translation

protected filterByTranslation(array $criteria, QueryBuilder $qb, Translation $translation = null)

Create filters according to any translation criteria OR argument.

Parameters

array $criteria
QueryBuilder $qb
Translation $translation

protected QueryBuilder getContextualQueryWithTranslation(array $criteria, array $orderBy = null, integer|null $limit = null, integer|null $offset = null, Translation $translation = null)

This method allows to pre-filter Documents with a given translation.

Parameters

array $criteria
array $orderBy
integer|null $limit
integer|null $offset
Translation $translation

Return Value

QueryBuilder

protected QueryBuilder getCountContextualQueryWithTranslation(array $criteria, Translation $translation = null)

This method allows to pre-filter Documents with a given translation.

Parameters

array $criteria
Translation $translation

Return Value

QueryBuilder

array|Paginator findBy(array $criteria, array $orderBy = null, integer|null $limit = null, integer|null $offset = null, Translation $translation = null)

Just like the findBy method but with relational criteria.

Parameters

array $criteria
array $orderBy
integer|null $limit
integer|null $offset
Translation $translation

Return Value

array|Paginator

ArrayCollection findOneBy(array $criteria, array $orderBy = null, Translation $translation = null)

Just like the findOneBy method but with relational criteria.

Parameters

array $criteria
array $orderBy
Translation $translation

Return Value

ArrayCollection

array findByNodeSourceAndField(NodesSources $nodeSource, NodeTypeField $field)

Parameters

NodesSources $nodeSource
NodeTypeField $field

Return Value

array

array findByNodeSourceAndFieldName(NodesSources $nodeSource, string $fieldName)

Parameters

NodesSources $nodeSource
string $fieldName

Return Value

array

array findAllSettingDocuments()

Find documents used as Settings.

Return Value

array

array findAllUnused()

Find all unused document.

Return Value

array