Doctrine


Doctrine\ORM\EntityRepository
/Doctrine/ORM/EntityRepository.php at line 40

Class EntityRepository

EntityRepository

public class EntityRepository

An EntityRepository serves as a repository for entities with generic as well as business specific methods for retrieving entities.

This class is designed for inheritance and users can subclass this class to write their own repositories with business-specific methods to locate entities.

License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
2.0
Version:
$Revision$
Author:
Benjamin Eberlei
Guilherme Blanco
Jonathan Wage
Roman Borschel

Field Summary
protected Doctrine\ORM\Mapping\ClassMetadata

$_class

protected EntityManager

$_em

protected string

$_entityName

Constructor Summary

EntityRepository(EntityManager em, mixed class, ClassMetadata classMetadata)

Initializes a new EntityRepository.

Method Summary
void

clear()

Clears the repository, causing all managed entities to become detached.

QueryBuilder

createQueryBuilder(string alias)

Create a new QueryBuilder instance that is prepopulated for this entity name

object

find(mixed id, $id The, int hydrationMode)

Finds an entity by its primary key / identifier.

array

findAll(int hydrationMode)

Finds all entities in the repository.

array

findBy(mixed criteria, string column, string value)

Finds entities by a set of criteria.

object

findOneBy(mixed criteria, string column, string value)

Finds a single entity by a set of criteria.

Field Detail

/Doctrine/ORM/EntityRepository.php at line 55

_class

protected Doctrine\ORM\Mapping\ClassMetadata $_class


/Doctrine/ORM/EntityRepository.php at line 50

_em

protected EntityManager $_em


/Doctrine/ORM/EntityRepository.php at line 45

_entityName

protected string $_entityName


Constructor Detail

/Doctrine/ORM/EntityRepository.php at line 63

EntityRepository

public EntityRepository(EntityManager em, mixed class, ClassMetadata classMetadata)

Initializes a new EntityRepository.

Parameters:
em - The EntityManager to use.
classMetadata - The class descriptor.

Method Detail

/Doctrine/ORM/EntityRepository.php at line 86

clear

public void clear()

Clears the repository, causing all managed entities to become detached.


/Doctrine/ORM/EntityRepository.php at line 76

createQueryBuilder

public QueryBuilder createQueryBuilder(string alias)

Create a new QueryBuilder instance that is prepopulated for this entity name

Returns:
$qb

/Doctrine/ORM/EntityRepository.php at line 98

find

public object find(mixed id, $id The, int hydrationMode)

Finds an entity by its primary key / identifier.

Parameters:
The - identifier.
hydrationMode - The hydration mode to use.
Returns:
The entity.

/Doctrine/ORM/EntityRepository.php at line 120

findAll

public array findAll(int hydrationMode)

Finds all entities in the repository.

Returns:
The entities.

/Doctrine/ORM/EntityRepository.php at line 132

findBy

public array findBy(mixed criteria, string column, string value)

Finds entities by a set of criteria.


/Doctrine/ORM/EntityRepository.php at line 144

findOneBy

public object findOneBy(mixed criteria, string column, string value)

Finds a single entity by a set of criteria.


Doctrine