1
0
mirror of synced 2025-01-31 04:21:44 +03:00

[2.0] Adding EntityRepository::createQueryBuilder() method

This commit is contained in:
jwage 2009-10-05 05:42:30 +00:00
parent 02519233f3
commit b353dc5172
3 changed files with 16 additions and 0 deletions

View File

@ -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
$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.
*/ */

View File

@ -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

View File

@ -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