Ejemplo n.º 1
0
 /**
  * Migrate old keys to new
  *
  * @param array $map
  * @return void
  */
 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);
     }
 }
Ejemplo n.º 2
0
 public function testUpdate()
 {
     $this->_adapterMock->expects($this->once())->method('update')->with('dummy', ['resource_id' => 'new'], ['resource_id = ?' => 'old']);
     $this->_model->update('old', 'new');
 }