class ResourceRepository extends Repository (View source)

PersistentResource Repository

Note that this repository is not part of the public API and must not be used in client code. Please use the API provided by ResourceManager instead.

Constants

ENTITY_CLASSNAME

Properties

protected PersistenceManagerInterface $persistenceManager
protected class-string $entityClassName

Warning: if you think you want to set this, look at RepositoryInterface::ENTITY_CLASSNAME first!

from  Repository
protected array $defaultOrderings from  Repository
protected EntityManagerInterface $entityManager
protected SplObjectStorage|PersistentResource[] $removedResources
protected SplObjectStorage|PersistentResource[] $addedResources

Methods

__construct()

Constructor

string
getEntityClassName()

Returns the classname of the entities this repository is managing.

void
add(object $object)

No description

void
remove(object $object)

Removes a PersistentResource object from this repository

findAll()

Returns all objects of this repository

object|null
findByIdentifier(mixed $identifier)

Finds an object matching the given identifier.

createQuery()

Returns a query for objects of this repository

int
countAll()

Counts all objects of this repository

void
removeAll()

Removes all objects of this repository as if remove() was called for all of them.

void
setDefaultOrderings(array $defaultOrderings)

Sets the property names to order results by. Expected like this: array( 'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING )

void
update(object $object)

Schedules a modified object for persistence.

mixed
__call(string $method, array $arguments)

Magic call method for repository methods.

void
resetAfterPersistingChanges()

Reset internal state after changes have been persisted

PersistentResource>
findAllIterator()

Finds all objects and return an IterableResult

PersistentResource>
findByCollectionNameIterator(string $collectionName)

Finds all objects by collection name and return an IterableResult

findSimilarResources(PersistentResource $resource)

Finds other resources which are referring to the same resource data, filename and collection

array
findBySha1(string $sha1Hash)

Find all resources with the same SHA1 hash

array
findBySha1AndCollectionName(string $sha1Hash, string $collectionName)

Find all resources with the same SHA1 hash and collection

int
countBySha1AndCollectionName(string $sha1Hash, string $collectionName)

Counts all resources with the same SHA1 hash and collection

findOneBySha1(string $sha1Hash)

Find one resource by SHA1

Details

__construct()

Constructor

string getEntityClassName()

Returns the classname of the entities this repository is managing.

Note that anything that is an "instanceof" this class is accepted by the repository.

Return Value

string

void add(object $object)

No description

Parameters

object $object

The object to add

Return Value

void

Exceptions

IllegalObjectTypeException

void remove(object $object)

Removes a PersistentResource object from this repository

Parameters

object $object

The object to remove

Return Value

void

QueryResultInterface findAll()

Returns all objects of this repository

Return Value

QueryResultInterface

The query result

See also

QueryInterface::execute

object|null findByIdentifier(mixed $identifier)

Finds an object matching the given identifier.

Parameters

mixed $identifier

The identifier of the object to find

Return Value

object|null

The matching object if found, otherwise NULL

QueryInterface createQuery()

Returns a query for objects of this repository

Return Value

QueryInterface

int countAll()

Counts all objects of this repository

Return Value

int

void removeAll()

Removes all objects of this repository as if remove() was called for all of them.

use DQL here, would be much more performant

Return Value

void

void setDefaultOrderings(array $defaultOrderings)

Sets the property names to order results by. Expected like this: array( 'foo' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING, 'bar' => \Neos\Flow\Persistence\QueryInterface::ORDER_DESCENDING )

Parameters

array $defaultOrderings

The property names to order by by default

Return Value

void

void update(object $object)

Schedules a modified object for persistence.

Parameters

object $object

The modified object

Return Value

void

Exceptions

IllegalObjectTypeException

mixed __call(string $method, array $arguments)

Magic call method for repository methods.

Provides three methods

  • findBy($value, $caseSensitive = true, $cacheResult = false)
  • findOneBy($value, $caseSensitive = true, $cacheResult = false)
  • countBy($value, $caseSensitive = true)

Parameters

string $method

Name of the method

array $arguments

The arguments

Return Value

mixed

The result of the repository method

void resetAfterPersistingChanges()

Reset internal state after changes have been persisted

Return Value

void

PersistentResource> findAllIterator()

Finds all objects and return an IterableResult

Return Value

PersistentResource>

PersistentResource> findByCollectionNameIterator(string $collectionName)

Finds all objects by collection name and return an IterableResult

Parameters

string $collectionName

Return Value

PersistentResource>

QueryResultInterface findSimilarResources(PersistentResource $resource)

Finds other resources which are referring to the same resource data, filename and collection

Parameters

PersistentResource $resource

The resource used for finding similar resources

Return Value

QueryResultInterface

The result, including the given resource

array findBySha1(string $sha1Hash)

Find all resources with the same SHA1 hash

Parameters

string $sha1Hash

Return Value

array

array findBySha1AndCollectionName(string $sha1Hash, string $collectionName)

Find all resources with the same SHA1 hash and collection

Parameters

string $sha1Hash
string $collectionName

Return Value

array

int countBySha1AndCollectionName(string $sha1Hash, string $collectionName)

Counts all resources with the same SHA1 hash and collection

Parameters

string $sha1Hash
string $collectionName

Return Value

int

PersistentResource findOneBySha1(string $sha1Hash)

Find one resource by SHA1

Parameters

string $sha1Hash

Return Value

PersistentResource

SplObjectStorage getAddedResources()

No description

Return Value

SplObjectStorage