class DocumentRepository extends AssetRepository (View source)

A repository for Documents

Properties

protected EntityManagerInterface $entityManager

Doctrine's Entity Manager.

from  AssetRepository
protected array $defaultOrderings from  AssetRepository
protected AssetService $assetService from  AssetRepository
protected ReflectionService $reflectionService from  AssetRepository

Methods

QueryResultInterface
findBySearchTermOrTags(string $searchTerm, array $tags = [], AssetCollection $assetCollection = null)

Find assets by title or given tags

QueryResultInterface
findByTag(Tag $tag, AssetCollection $assetCollection = null)

Find Assets with the given Tag assigned

int
countByTag(Tag $tag, AssetCollection $assetCollection = null)

Counts Assets with the given Tag assigned

QueryResultInterface
findAll(AssetCollection $assetCollection = null)

No description

int
countAll()

No description

QueryResultInterface
findUntagged(AssetCollection $assetCollection = null)

Find Assets without any tag

int
countUntagged(AssetCollection $assetCollection = null)

Counts Assets without any tag

QueryResultInterface
findByAssetCollection(AssetCollection $assetCollection)

No description

int
countByAssetCollection(AssetCollection $assetCollection)

Count assets by asset collection

void
addAssetCollectionToQueryConstraints(QueryInterface $query, AssetCollection $assetCollection = null)

No description

void
addAssetVariantFilterClause(Query $query)

Adds conditions filtering any implementation of AssetVariantInterface

string
getAssetVariantFilterClauseForDql(string $alias)

Returns a DQL clause filtering any implementation of AssetVariantInterface

AssetInterface|null
findOneByResourceSha1(string $sha1)

No description

Generator|null
iterate(IterableResult $iterator, callable $callback = null)

Iterate over an IterableResult and return a Generator

IterableResult
findAllIterator()

Find all objects and return an IterableResult

void
remove(AssetInterface $object)

Remove an asset while first validating if the object can be removed or if removal is blocked because the asset is still in use.

void
removeWithoutUsageChecks(AssetInterface $object)

Remove the asset even if it is still in use. Use with care, it is probably better to first make sure the asset is not used anymore and then use the remove() method for removal.

add(AssetInterface $object)

No description

update(AssetInterface $object)

No description

Details

QueryResultInterface findBySearchTermOrTags(string $searchTerm, array $tags = [], AssetCollection $assetCollection = null)

Find assets by title or given tags

Parameters

string $searchTerm
array $tags
AssetCollection $assetCollection

Return Value

QueryResultInterface

Exceptions

InvalidQueryException

QueryResultInterface findByTag(Tag $tag, AssetCollection $assetCollection = null)

Find Assets with the given Tag assigned

Parameters

Tag $tag
AssetCollection $assetCollection

Return Value

QueryResultInterface

Exceptions

InvalidQueryException

int countByTag(Tag $tag, AssetCollection $assetCollection = null)

Counts Assets with the given Tag assigned

Parameters

Tag $tag
AssetCollection $assetCollection

Return Value

int

QueryResultInterface findAll(AssetCollection $assetCollection = null)

No description

Parameters

AssetCollection $assetCollection

Return Value

QueryResultInterface

Exceptions

InvalidQueryException

int countAll()

No description

Return Value

int

QueryResultInterface findUntagged(AssetCollection $assetCollection = null)

Find Assets without any tag

Parameters

AssetCollection $assetCollection

Return Value

QueryResultInterface

Exceptions

InvalidQueryException

int countUntagged(AssetCollection $assetCollection = null)

Counts Assets without any tag

Parameters

AssetCollection $assetCollection

Return Value

int

QueryResultInterface findByAssetCollection(AssetCollection $assetCollection)

No description

Parameters

AssetCollection $assetCollection

Return Value

QueryResultInterface

Exceptions

InvalidQueryException

int countByAssetCollection(AssetCollection $assetCollection)

Count assets by asset collection

Parameters

AssetCollection $assetCollection

Return Value

int

protected void addAssetCollectionToQueryConstraints(QueryInterface $query, AssetCollection $assetCollection = null)

No description

Parameters

QueryInterface $query
AssetCollection $assetCollection

Return Value

void

Exceptions

InvalidQueryException

protected void addAssetVariantFilterClause(Query $query)

Adds conditions filtering any implementation of AssetVariantInterface

Parameters

Query $query

Return Value

void

protected string getAssetVariantFilterClauseForDql(string $alias)

Returns a DQL clause filtering any implementation of AssetVariantInterface

Parameters

string $alias

Return Value

string

AssetInterface|null findOneByResourceSha1(string $sha1)

No description

Parameters

string $sha1

Return Value

AssetInterface|null

Generator|null iterate(IterableResult $iterator, callable $callback = null)

Iterate over an IterableResult and return a Generator

This method is useful for batch processing huge result set as it clears the object manager and detaches the current object on each iteration.

Parameters

IterableResult $iterator
callable $callback

Return Value

Generator|null

IterableResult findAllIterator()

Find all objects and return an IterableResult

Return Value

IterableResult

void remove(AssetInterface $object)

Remove an asset while first validating if the object can be removed or if removal is blocked because the asset is still in use.

Parameters

AssetInterface $object

Return Value

void

Exceptions

IllegalObjectTypeException
AssetServiceException

void removeWithoutUsageChecks(AssetInterface $object)

Remove the asset even if it is still in use. Use with care, it is probably better to first make sure the asset is not used anymore and then use the remove() method for removal.

Parameters

AssetInterface $object

Return Value

void

Exceptions

IllegalObjectTypeException

add(AssetInterface $object)

No description

Parameters

AssetInterface $object

Exceptions

IllegalObjectTypeException

update(AssetInterface $object)

No description

Parameters

AssetInterface $object

Exceptions

IllegalObjectTypeException