/**
  * {@inheritdoc}
  */
 public function finish(Message $message)
 {
     $job = $this->jobRepository->findByUid($message->getIdentifier());
     $job->setState(Message::STATE_DONE);
     $this->jobRepository->remove($job);
     $this->persistenceManager->persistAll();
     $message->setState($job->getState());
     return true;
 }
 /**
  * Make sure we remember the objects that are not currently add()ed
  * but might be in persistent storage.
  *
  * @test
  */
 public function removeRetainsObjectForObjectsNotInCurrentSession()
 {
     $object = new \ArrayObject(array('val' => '1'));
     $persistenceManager = new \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager();
     $persistenceManager->remove($object);
     $this->assertAttributeContains($object, 'removedObjects', $persistenceManager);
 }