After introducing phinx as a database migration tool, I am no longer able to use true and false through PDO's execute statement. Whenever I do, I get the following error:
PHP Warning: PDOStatement::execute(): SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'my_db'.'my_table'.'my_column' at row 1...
My table has the following schema (shorted):
| Field | Type | Null | Key | Default | Extra |
+-------------------------------+--------------+------+-----+---------+----------------+
| my_column | tinyint(1) | NO | | NULL | |
+-------------------------------+--------------+------+-----+---------+----------------+
I am using the following code (shorted):
$stmt = $this->pdo->prepare("INSERT INTO `$table` (`my_column`) VALUES (:mycolumn)");
$stmt->execute([
'my_column' => false
]);
The column is created by the migration script with:
->addColumn('my_column', 'boolean', [
'null' => false,
'after' => 'another_column',
])
The strange thing is, that I have no problems with using true and false in manual sql statements through phpMyAdmin.