PHP Class FactoryGirl\Provider\Doctrine\ORM\Repository

Inheritance: extends Doctrine\ORM\EntityRepository
Afficher le fichier Open project: breerly/factory-girl-php Class Usage Examples

Méthodes publiques

Méthode Description
getEntityName ( ) : string
getReference ( mixed $identifier ) : object Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded.
transaction ( $transaction ) : mixed Perform a callback function within a transaction. If an exception occurs within the function, it's catched, the transaction is rolled back and the exception rethrown.
transactionWithTableLock ( integer $lockMode, callback $transaction ) : mixed Attempt to acquire a table level lock in MySQL for the duration of the given transaction. IS NOT IN ANY WAY GUARANTEED TO WORK.
useWithLock ( integer $id, integer $lockMode, $callback ) : mixed Acquires a lock to an entity, provides the entity to a callback function and relinquishes the lock by flushing the entity manager immediately after.
useWithPessimisticVersionLock ( integer $id, mixed $lockVersion, $callback ) : mixed Acquires an optimistic lock within a pessimistic lock transaction. For use in fail-fast scenarios; guaranteed to throw an exception on concurrent modification attempts. The one to first acquire the write lock will update the version field, leading subsequent acquisitions of the optimistic lock to fail.
useWithPessimisticWriteLock ( integer $id, $callback ) : mixed Calls useWithLock() with a pessimistic write lock mode

Méthodes protégées

Méthode Description
getBaseQueryBuilder ( ) : QueryBuilder Create a query builder. Override this in a child class to create a builder of the appropriate type.
getQueryResult ( Doctrine\ORM\QueryBuilder $builder ) : mixed
getSingleQueryResult ( Doctrine\ORM\QueryBuilder $builder, callback(Exception) $fallback = null ) : object | null
getSingleScalarQueryResult ( Doctrine\ORM\QueryBuilder $builder, callback(Exception) $fallback = null ) : object | null
withQueryBuilder ( $do ) : QueryBuilder Create a query builder, perform the given operation on it and return the query builder. The operation callback receives the query builder and its associated expression builder as arguments.

Private Methods

Méthode Description
attemptQuery ( callback $do, callback $fallback = null ) : mixed Guards against NoResultException and NonUniqueResultException within a callback. Uses a fallback callback in case an exception does occur.
getTableLock ( ) : TableLock

Method Details

getBaseQueryBuilder() protected méthode

Create a query builder. Override this in a child class to create a builder of the appropriate type.
protected getBaseQueryBuilder ( ) : QueryBuilder
Résultat QueryBuilder

getEntityName() public méthode

public getEntityName ( ) : string
Résultat string

getQueryResult() protected méthode

protected getQueryResult ( Doctrine\ORM\QueryBuilder $builder ) : mixed
$builder Doctrine\ORM\QueryBuilder
Résultat mixed result

getReference() public méthode

Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded.
public getReference ( mixed $identifier ) : object
$identifier mixed The entity identifier.
Résultat object The entity reference.

getSingleQueryResult() protected méthode

protected getSingleQueryResult ( Doctrine\ORM\QueryBuilder $builder, callback(Exception) $fallback = null ) : object | null
$builder Doctrine\ORM\QueryBuilder
$fallback callback(Exception)
Résultat object | null | null result or return value from fallback

getSingleScalarQueryResult() protected méthode

protected getSingleScalarQueryResult ( Doctrine\ORM\QueryBuilder $builder, callback(Exception) $fallback = null ) : object | null
$builder Doctrine\ORM\QueryBuilder
$fallback callback(Exception)
Résultat object | null | null result or return value from fallback

transaction() public méthode

Perform a callback function within a transaction. If an exception occurs within the function, it's catched, the transaction is rolled back and the exception rethrown.
public transaction ( $transaction ) : mixed
Résultat mixed the callback return value

transactionWithTableLock() public méthode

Attempt to acquire a table level lock in MySQL for the duration of the given transaction. IS NOT IN ANY WAY GUARANTEED TO WORK.
See also: TableLock
public transactionWithTableLock ( integer $lockMode, callback $transaction ) : mixed
$lockMode integer a TableLockMode constant
$transaction callback
Résultat mixed

useWithLock() public méthode

Acquires a lock to an entity, provides the entity to a callback function and relinquishes the lock by flushing the entity manager immediately after.
public useWithLock ( integer $id, integer $lockMode, $callback ) : mixed
$id integer
$lockMode integer
Résultat mixed callback return type

useWithPessimisticVersionLock() public méthode

FIXME: Only works on entities implementing VersionLockable and does not work in conjunction with the Doctrine @Version column.
public useWithPessimisticVersionLock ( integer $id, mixed $lockVersion, $callback ) : mixed
$id integer
$lockVersion mixed
Résultat mixed callback return type

useWithPessimisticWriteLock() public méthode

Calls useWithLock() with a pessimistic write lock mode
public useWithPessimisticWriteLock ( integer $id, $callback ) : mixed
$id integer
Résultat mixed callback return type

withQueryBuilder() protected méthode

Create a query builder, perform the given operation on it and return the query builder. The operation callback receives the query builder and its associated expression builder as arguments.
protected withQueryBuilder ( $do ) : QueryBuilder
Résultat QueryBuilder