Repository
abstract class Repository extends EntityRepository implements RepositoryInterface (View source)
The Flow default Repository, based on Doctrine 2
Properties
protected PersistenceManagerInterface | $persistenceManager | ||
protected EntityManagerInterface | $entityManager | ||
protected string | $objectType | Warning: if you think you want to set this, look at RepositoryInterface::ENTITY_CLASSNAME first! |
|
protected array | $defaultOrderings |
Methods
Initializes a new Repository.
Returns the classname of the entities this repository is managing.
Adds an object to this repository.
Removes an object from this repository.
Finds all entities in the repository.
Find all objects and return an IterableResult
Iterate over an IterableResult and return a Generator
Finds an object matching the given identifier.
Returns a query for objects of this repository
Creates a DQL query from the given query string
Counts all objects of this repository
Removes all objects of this repository as if remove() was called for all of them.
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 )
Schedules a modified object for persistence.
Magic call method for repository methods.
Details
__construct(EntityManagerInterface $entityManager, ClassMetadata $classMetadata = null)
Initializes a new Repository.
string
getEntityClassName()
Returns the classname of the entities this repository is managing.
void
add(object $object)
Adds an object to this repository.
void
remove(object $object)
Removes an object from this repository.
QueryResultInterface
findAll()
Finds all entities in the repository.
IterableResult
findAllIterator()
Find all objects and return an IterableResult
Generator|null
iterate(IterableResult $iterator, callable $callback = null)
Iterate over an IterableResult and return a Generator
This method is useful for batch processing a huge result set.
object|null
findByIdentifier(mixed $identifier)
Finds an object matching the given identifier.
QueryInterface
createQuery()
Returns a query for objects of this repository
Query
createDqlQuery(string $dqlString)
Creates a DQL query from the given query string
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.
Provides three methods
- findBy
($value, $caseSensitive = true, $cacheResult = false) - findOneBy
($value, $caseSensitive = true, $cacheResult = false) - countBy
($value, $caseSensitive = true)