예제 #1
0
파일: App.php 프로젝트: hikouki/stigma
 /**
  * Execute.
  * @param $databaseFilePath Database file path.
  * @param $target replace target string.
  * @param $replace replaced string.
  * @return void
  */
 public function execute($databaseFilePath, $target, $replace)
 {
     Database::load($databaseFilePath);
     $tables = Model::findAllTableStructure();
     foreach ($tables as $table) {
         $rows = Model::findAll($table);
         foreach ($rows as &$row) {
             if ($this->replaceIfHit($row, $target, $replace)) {
                 Model::updateRow($row, $table);
             }
         }
     }
 }
예제 #2
0
 public function testUpdateRow()
 {
     Model::updateRow(['id' => 1, 'name' => 'stigma'], 'users');
     $rows = Model::findAll("users");
     $this->assertSame($rows, [['id' => '1', 'name' => 'stigma'], ['id' => '2', 'name' => 'bob'], ['id' => '3', 'name' => 'mikel'], ['id' => '4', 'name' => 'jon']]);
 }