PHP Class FactoryGirl\Provider\Doctrine\ORM\Locking\TableLock

See also: transaction()
Show file Open project: breerly/factory-girl-php

Public Methods

Method Description
__construct ( Repository $repository )
transaction ( 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. MySQL requires that the aliases through which a table is accessed during this transaction are enumerated when locking tables, which due to the nature of Doctrine is a somewhat difficult task. Nevertheless, in simple cases a good guesstimate as to the table aliases can be made; see relevant methods below.

Protected Methods

Method Description
getRepository ( ) : Repository

Private Methods

Method Description
constructLockString ( string $tableName, array $aliases, string $lockModeString ) : string
getLockString ( integer $lockMode ) : string Get the MySQL statement for locking the table underlying this repository for simple read and/or write operations given an appropriate lock mode
getTableAliasGuesstimates ( string $tableName ) : array Attempt to guess at the table name aliases used by Doctrine for a given table name
getTableName ( ) : string
getUnlockString ( ) : string The MySQL statement required to unlock tables after a transaction

Method Details

__construct() public method

public __construct ( Repository $repository )
$repository FactoryGirl\Provider\Doctrine\ORM\Repository

getRepository() protected method

protected getRepository ( ) : Repository
return FactoryGirl\Provider\Doctrine\ORM\Repository

transaction() public method

Attempt to acquire a table level lock in MySQL for the duration of the given transaction. IS NOT IN ANY WAY GUARANTEED TO WORK. MySQL requires that the aliases through which a table is accessed during this transaction are enumerated when locking tables, which due to the nature of Doctrine is a somewhat difficult task. Nevertheless, in simple cases a good guesstimate as to the table aliases can be made; see relevant methods below.
public transaction ( integer $lockMode, callback $transaction ) : mixed
$lockMode integer a TableLockMode constant
$transaction callback
return mixed