/**
  * Synchronizes the $className objects from the source system to the destination system.
  *
  * @param string $className
  * @param bool $force
  */
 public function synchronize($className, $force)
 {
     $this->logger->notice('Start of ' . ($force ? 'forced ' : '') . 'synchronization for {className}.', array('className' => $className));
     $this->className = $className;
     $this->mapper->setForce($force);
     $this->sourceQueue = $this->source->getObjectsOrderedById();
     $this->sourceQueue->rewind();
     $this->destinationQueue = $this->destination->getObjectsOrderedById($className);
     $this->destinationQueue->rewind();
     while ($this->sourceQueue->valid() && $this->destinationQueue->valid()) {
         $this->compareQueuesAndReactAccordingly();
     }
     $this->insertRemainingSourceObjects();
     $this->deleteRemainingDestinationObjects();
     $this->destination->commit();
     $this->logger->notice('End of synchronization for {className}.', array('className' => $className));
 }
 /**
  * @param \Iterator $sourceObjects
  */
 private function setUpSourceToReturn(\Iterator $sourceObjects)
 {
     $this->source->expects($this->any())->method('getObjectsOrderedById')->will($this->returnValue($sourceObjects));
 }