Example #1
0
 public function table($name)
 {
     $assert = $this->service('assert');
     if (!isset($this->tables[$name])) {
         $primaryKeys = $this->adapter->pk($name);
         $assert->notEmpty($primaryKeys, "{$name} does not have a primary key so I can not examine differences");
         $table = new Table();
         $assert->hasIndex($this->snapshot, $name, "The table {$name} don't has created snapshot.");
         $snapshotA = $this->snapshot[$name][0];
         $snapshotB = $snapshotA;
         if (isset($this->snapshot[$name][1])) {
             // nie istnieje snapshot nastepny tabeli
             $snapshotB = $this->snapshot[$name][1];
         }
         $table->setSnapshotA($snapshotA)->setSnapshotB($snapshotB)->setPrimaryKey($primaryKeys);
         $table->diff();
         $this->tables[$name] = $table;
     }
     return $this->tables[$name];
 }