PHP Class FactoryGirl\Provider\Doctrine\ORM\QueryBuilder

Inheritance: extends Doctrine\ORM\QueryBuilder
Show file Open project: breerly/factory-girl-php Class Usage Examples

Protected Properties

Property Type Description
$_queryConfigurers array
$_statuses
$entityAlias string Entity alias associated with this query builder (if any)
$entityName string Entity name associated with this query builder (if any)

Public Methods

Method Description
__construct ( EntityManager $em, string $entityName = null, string $entityAlias = null )
_configureQuery ( callback(Doctrine\ORM\Query) $configurer ) : QueryBuilder NOTE: Should be protected
create ( EntityManager $em ) : QueryBuilder Create a new QueryBuilder of the type that receives this static call.
getQuery ( ) : Doctrine\ORM\Query Configures the created Query using the configurers added to this builder
init ( ) Post-construction template method

Protected Methods

Method Description
asPartial ( ) : QueryBuilder Configures the query to force result objects to be partially loaded
ensure ( string $status, callback(QueryBuilder) $operation ) : QueryBuilder Ensure that a certain operation has been performed on this object.

Method Details

__construct() public method

public __construct ( EntityManager $em, string $entityName = null, string $entityAlias = null )
$em Doctrine\ORM\EntityManager
$entityName string
$entityAlias string

_configureQuery() public method

NOTE: Should be protected
public _configureQuery ( callback(Doctrine\ORM\Query) $configurer ) : QueryBuilder
$configurer callback(Doctrine\ORM\Query)
return QueryBuilder

asPartial() protected method

Configures the query to force result objects to be partially loaded
protected asPartial ( ) : QueryBuilder
return QueryBuilder

create() public static method

Create a new QueryBuilder of the type that receives this static call.
public static create ( EntityManager $em ) : QueryBuilder
$em Doctrine\ORM\EntityManager
return QueryBuilder

ensure() protected method

$status is a string that describes state the operation should affect and $operation is a callback which is executed if and only if the status is not already in effect. Example: public function withProduct() { return $this->ensure('product is joined', function($qb) { $qb->join('pv.product', 'p'); }); } Should be used to allow the possibility of several different methods each wanting to affect a certain state without messing up the query by duplicate calls to methods. Has the pleasant side effect of describing the results of operations on a more intimate level than the plain object API can allow for, making for more self-documenting code.
protected ensure ( string $status, callback(QueryBuilder) $operation ) : QueryBuilder
$status string
$operation callback(QueryBuilder)
return QueryBuilder

getQuery() public method

Configures the created Query using the configurers added to this builder
public getQuery ( ) : Doctrine\ORM\Query
return Doctrine\ORM\Query

init() public method

Prepopulates with entity if both entity name and alias are set.
public init ( )

Property Details

$_queryConfigurers protected property

protected array $_queryConfigurers
return array

$_statuses protected property

protected $_statuses

$entityAlias protected property

Entity alias associated with this query builder (if any)
protected string $entityAlias
return string

$entityName protected property

Entity name associated with this query builder (if any)
protected string $entityName
return string