Commit b353dc51 authored by jwage's avatar jwage

[2.0] Adding EntityRepository::createQueryBuilder() method

parent 02519233
...@@ -32,6 +32,7 @@ namespace Doctrine\ORM; ...@@ -32,6 +32,7 @@ namespace Doctrine\ORM;
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/ */
class EntityRepository class EntityRepository
{ {
...@@ -52,6 +53,19 @@ class EntityRepository ...@@ -52,6 +53,19 @@ class EntityRepository
$this->_class = $class; $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. * Clears the repository, causing all managed entities to become detached.
*/ */
......
...@@ -38,6 +38,7 @@ use Doctrine\Common\DoctrineException; ...@@ -38,6 +38,7 @@ use Doctrine\Common\DoctrineException;
* the serialized representation). * the serialized representation).
* *
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @since 2.0 * @since 2.0
*/ */
final class ClassMetadata extends ClassMetadataInfo final class ClassMetadata extends ClassMetadataInfo
......
...@@ -38,6 +38,7 @@ use Doctrine\Common\DoctrineException; ...@@ -38,6 +38,7 @@ use Doctrine\Common\DoctrineException;
* the serialized representation). * the serialized representation).
* *
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class ClassMetadataInfo class ClassMetadataInfo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment