protected function executeOperations(array $operations)
{
$lastType = null;
$batch = array();
foreach ($operations as $operation) {
if ($operation->skip) {
continue;
}
if (null === $lastType) {
$lastType = $operation->type;
}
if ($operation->type !== $lastType) {
$this->executeBatch($lastType, $batch);
$lastType = $operation->type;
$batch = array();
}
$batch[] = $operation;
}
// only execute last batch if not all was skipped
if (!count($batch)) {
return;
}
$this->executeBatch($lastType, $batch);
}