public function flush()
{
$debug = $this->container->get('kernel')->isDebug();
// Only log and write to text files when debugging
if (!$debug) {
return true;
}
$logger = $this->container->get('logger');
$commandList = array('add' => $this->add, 'update' => $this->update, 'delete' => $this->delete);
$logger->info(__CLASS__ . ': start logging index commands');
foreach ($commandList as $name => $commands) {
foreach ($commands as $command) {
$logString = is_array($command) ? json_encode($command) : $command;
$logger->info($name . ': ' . $logString);
}
}
$logger->info(__CLASS__ . ': finished logging index commands');
return true;
}