ORMPurger
in package
implements
PurgerInterface, ORMPurgerInterface
Class responsible for purging databases of data before reloading data fixtures.
Interfaces, Classes, Traits and Enums
- PurgerInterface
- PurgerInterface
- ORMPurgerInterface
- ORMPurgerInterface
Table of Contents
- PURGE_MODE_DELETE = 1
- PURGE_MODE_TRUNCATE = 2
- $em : EntityManagerInterface|null
- $excluded : array<string|int, string>
- Table/view names to be excluded from purge
- $purgeMode : int
- If the purge should be done through DELETE or TRUNCATE statements
- __construct() : mixed
- Construct new purger instance.
- getObjectManager() : EntityManagerInterface
- Retrieve the EntityManagerInterface instance this purger instance is using.
- getPurgeMode() : int
- Get the purge mode
- purge() : void
- Purge the data from the database for the given EntityManager.
- setEntityManager() : void
- Set the EntityManagerInterface instance this purger instance should use.
- setPurgeMode() : void
- Set the purge mode
- getAssociationTables() : array<string|int, mixed>
- getCommitOrder() : array<string|int, ClassMetadata>
- getDeleteFromTableSQL() : string
- getJoinTableName() : string
- getTableName() : string
Constants
PURGE_MODE_DELETE
public
mixed
PURGE_MODE_DELETE
= 1
PURGE_MODE_TRUNCATE
public
mixed
PURGE_MODE_TRUNCATE
= 2
Properties
$em
private
EntityManagerInterface|null
$em
$excluded
Table/view names to be excluded from purge
private
array<string|int, string>
$excluded
$purgeMode
If the purge should be done through DELETE or TRUNCATE statements
private
int
$purgeMode
= self::PURGE_MODE_DELETE
Methods
__construct()
Construct new purger instance.
public
__construct([EntityManagerInterface $em = null ][, array<string|int, string> $excluded = [] ]) : mixed
Parameters
- $em : EntityManagerInterface = null
-
EntityManagerInterface instance used for persistence.
- $excluded : array<string|int, string> = []
-
array of table/view names to be excluded from purge
Return values
mixed —getObjectManager()
Retrieve the EntityManagerInterface instance this purger instance is using.
public
getObjectManager() : EntityManagerInterface
Return values
EntityManagerInterface —getPurgeMode()
Get the purge mode
public
getPurgeMode() : int
Return values
int —purge()
Purge the data from the database for the given EntityManager.
public
purge() : void
Tags
Return values
void —setEntityManager()
Set the EntityManagerInterface instance this purger instance should use.
public
setEntityManager(EntityManagerInterface $em) : void
Parameters
- $em : EntityManagerInterface
Tags
Return values
void —setPurgeMode()
Set the purge mode
public
setPurgeMode(int $mode) : void
Parameters
- $mode : int
Return values
void —getAssociationTables()
private
getAssociationTables(array<string|int, mixed> $classes, AbstractPlatform $platform) : array<string|int, mixed>
Parameters
- $classes : array<string|int, mixed>
- $platform : AbstractPlatform
Return values
array<string|int, mixed> —getCommitOrder()
private
getCommitOrder(EntityManagerInterface $em, array<string|int, ClassMetadata> $classes) : array<string|int, ClassMetadata>
Parameters
- $em : EntityManagerInterface
- $classes : array<string|int, ClassMetadata>
Return values
array<string|int, ClassMetadata> —getDeleteFromTableSQL()
private
getDeleteFromTableSQL(string $tableName, AbstractPlatform $platform) : string
Parameters
- $tableName : string
- $platform : AbstractPlatform
Return values
string —getJoinTableName()
private
getJoinTableName(array<string|int, mixed> $assoc, ClassMetadata $class, AbstractPlatform $platform) : string
Parameters
- $assoc : array<string|int, mixed>
- $class : ClassMetadata
- $platform : AbstractPlatform
Return values
string —getTableName()
private
getTableName(ClassMetadata $class, AbstractPlatform $platform) : string
Parameters
- $class : ClassMetadata
- $platform : AbstractPlatform