Permalink
Browse files

Fixing issue with boolean columns not correctly inserting

data in MySQL.
Fixes #1922
  • Loading branch information...
1 parent 443ff92 commit 3bfd81571633b2d781b0aaea64bb128ff6f7231b @markstory markstory committed Aug 30, 2011
Showing with 4 additions and 0 deletions.
  1. +3 −0 cake/console/libs/tasks/fixture.php
  2. +1 −0 cake/tests/cases/console/libs/tasks/fixture.test.php
@@ -383,6 +383,9 @@ function _getRecordsFromTable($modelName, $useTable = null) {
foreach ($records as $record) {
$row = array();
foreach ($record[$modelObject->alias] as $field => $value) {
+ if ($schema[$field]['type'] === 'boolean') {
+ $value = (int)(bool)$value;
+ }
$row[$field] = $value;
}
$out[] = $row;
@@ -354,6 +354,7 @@ function testRecordGenerationForBinaryAndFloat() {
$result = $this->Task->bake('Article', 'datatypes');
$this->assertPattern("/'float_field' => 1/", $result);
+ $this->assertPattern("/'bool' => 1/", $result);
$result = $this->Task->bake('Article', 'binary_tests');
$this->assertPattern("/'data' => 'Lorem ipsum dolor sit amet'/", $result);

0 comments on commit 3bfd815

Please sign in to comment.