diff --git a/lib/Doctrine/ORM/EntityRepository.php b/lib/Doctrine/ORM/EntityRepository.php index 1c2c11d43..5b8563f9b 100644 --- a/lib/Doctrine/ORM/EntityRepository.php +++ b/lib/Doctrine/ORM/EntityRepository.php @@ -32,6 +32,7 @@ namespace Doctrine\ORM; * @link www.doctrine-project.org * @since 2.0 * @author Roman Borschel + * @author Jonathan H. Wage */ class EntityRepository { @@ -52,6 +53,19 @@ class EntityRepository $this->_class = $class; } + /** + * Create a new QueryBuilder instance that is prepopulated for this entity name + * + * @param string $alias + * @return QueryBuilder $qb + */ + public function createQueryBuilder($alias) + { + return $this->_em->createQueryBuilder() + ->select($alias) + ->from($this->_entityName); + } + /** * Clears the repository, causing all managed entities to become detached. */ diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index f3d2d8c14..62eb079d5 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -38,6 +38,7 @@ use Doctrine\Common\DoctrineException; * the serialized representation). * * @author Roman Borschel + * @author Jonathan H. Wage * @since 2.0 */ final class ClassMetadata extends ClassMetadataInfo diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index d73ba560f..9f6982000 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -38,6 +38,7 @@ use Doctrine\Common\DoctrineException; * the serialized representation). * * @author Roman Borschel + * @author Jonathan H. Wage * @since 2.0 */ class ClassMetadataInfo