示例#1
0
 /**
  * Migrate old keys to new
  *
  * @param array $map
  */
 public function migrate($map)
 {
     foreach ($this->_reader->fetchAll() as $oldKey => $count) {
         $newKey = isset($map[$oldKey]) ? $map[$oldKey] : null;
         if (in_array($oldKey, $map)) {
             $newKey = $oldKey;
             $oldKey = null;
         }
         if ($newKey && $oldKey && $this->_mode == self::WRITE_MODE) {
             $this->_writer->update($oldKey, $newKey);
         }
         $this->_logger->add($oldKey, $newKey, $count);
     }
 }
示例#2
0
 public function testUpdate()
 {
     $this->_adapterMock->expects($this->once())->method('update')->with('dummy', array('resource_id' => 'new'), array('resource_id = ?' => 'old'));
     $this->_model->update('old', 'new');
 }