// let console commands handle flushes anyway they want
18
return;
19
}
20
21
$em = $args->getEntityManager();
22
if ($em->getConnection()->isTransactionActive()) {
23
// the transaction is managed manually and was already started
24
// probably it won't be handled since it is the end of response
25
// but anyways, it won't cause trouble
26
return;
27
}
28
29
if ($this->flushed) {
30
throw new \BadMethodCallException("The flush can be run only once and is run automatically in the end of each request to prevent data inconsistencies and bad design.");