Example #1
0
 /**
  * Insert record in the database.
  */
 private function insert()
 {
     $last_insert_id = $this->connection->insert($this->table_name, $this->values);
     if (empty($this->values[$this->auto_increment])) {
         $this->values[$this->auto_increment] = $last_insert_id;
     }
     $this->values = array_merge($this->values, $this->refreshGeneratedFieldValues($last_insert_id));
     $this->setAsLoaded();
 }
 /**
  * {@inheritdoc}
  */
 public function execute(MigrationInterface $migration)
 {
     if ($this->isExecuted($migration)) {
         throw new LogicException('Migration ' . get_class($migration) . ' is already executed');
     }
     $this->connection->transact(function () use($migration) {
         $migration->up();
         $this->connection->insert($this->getTableName(), ['migration' => get_class($migration), 'executed_at' => new DateTimeValue()]);
     });
 }