can't reproduce. unit-test? ticket?
Are we talking about this? :
$Test = $this->Test->create(array('machine_id'=>null));
$Test>reload();
$this->assertNull($Test->post_id);
What I meant was an empty foreign key is set always set to 0 even though it should be set to null. This is true for both inserts and update. For instance,
function test_empty_foreign_key_set_to_null_on_create() {
$params = array('name'=>'Empty foreign key field should be set to NULL', 'machine_id'=>'');
$Testrun =& new Testrun();
$Testrun->setAttributes($params);
$this->assertTrue($Testrun->save());
$Testrun->reload();
$this->assertNull($Testrun->get('machine_id'));
}
function test_empty_foreign_key_set_to_null_on_update() {
$Testrun =& new Testrun();
$Testrun->newRecord('id->','2','name->','All fields filled.','machine_id->','1');
$this->assertTrue($Testrun->save());
$Testrun->update(2, array('name'=>'machine_id should be NULL','machine_id'=>''));
$tRecord = $Testrun->find(2);
$this->assertNull($tRecord->machine_id);
}
Ticket # 129.
1 to 3 of 3