Skip to content

Commit bb7e2fa

Browse files
authored
Fix Date/Datetime seeding
1 parent a6fe385 commit bb7e2fa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Phinx/Db/Adapter/PdoAdapter.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Cake\Database\Query\InsertQuery;
1616
use Cake\Database\Query\SelectQuery;
1717
use Cake\Database\Query\UpdateQuery;
18+
use Cake\I18n\Date;
19+
use Cake\I18n\DateTime;
1820
use InvalidArgumentException;
1921
use PDO;
2022
use PDOException;
@@ -430,6 +432,10 @@ public function bulkinsert(Table $table, array $rows): void
430432
foreach ($row as $v) {
431433
if ($v instanceof Literal) {
432434
continue;
435+
} elseif ($v instanceof DateTime) {
436+
$vals[] = $v->toDateTimeString();
437+
} elseif ($v instanceof Date) {
438+
$vals[] = $v->toDateString();
433439
} elseif (is_bool($v)) {
434440
$vals[] = $this->castToBool($v);
435441
} else {

0 commit comments

Comments
 (0)