示例#1
0
 /**
  * {@inheritodc}
  */
 public function clear(FeedInterface $feed, array &$context)
 {
     try {
         $this->dispatchEvent(FeedsEvents::INIT_CLEAR, new InitEvent($feed));
         $this->dispatchEvent(FeedsEvents::CLEAR, new ClearEvent($feed));
     } catch (\Exception $exception) {
         // Do nothing yet.
     }
     // Clean up.
     $context['finished'] = $feed->progressClearing();
     if (isset($exception)) {
         $context['finished'] = StateInterface::BATCH_COMPLETE;
     }
     if ($context['finished'] === StateInterface::BATCH_COMPLETE) {
         $feed->finishClear();
         $feed->save();
         $feed->unlock();
     } else {
         $feed->saveStates();
     }
     if (isset($exception)) {
         throw $exception;
     }
 }