Wie igrossiter darauf hingewiesen hat, gibt es dafür eine Methode, der Name der Methode ist insert
use Phinx\Migration\AbstractMigration;
class NewStatus extends AbstractMigration
{
protected $statusId = 1234; //It'd be nice to use an entity constant instead of magic numbers, but that's up to you.
protected $statusName = 'In Progress';
/**
* Migrate Up.
*/
public function up()
{
$columns = ['id', 'name'];
$data = [[$this->statusId, $this->statusName]];
$table = $this->table('status');
$table->insert($columns, $data);
$table->saveData();
}
/**
* Migrate Down.
*/
public function down()
{
$this->execute('Delete from status where id = ' . $this->statusId);
}
}
Stand:2. Dezember 2015
Die Signatur dieser Methode wird sich in zukünftigen stabilen Versionen in etwas wie
ändern$data = [
['id' => 1, 'name' => 'foo'],
['id' => 2, 'name' => 'bar']
];
$table = $this->table('status');
$table->insert($data);
Weitere Infos hier