I have a dropdown in my Yii form created with CActiveForm->dropDownList.
I am using the array('empty'=>'Please select one') as the way to set the value when nothing is selected.
The field is constrained to another table, but it is set to allow NULL. When Yii shows the MySQL error, it says:
integrity constraint violation: 1452 Cannot add or update a child row: a foreign
key constraint fails (`imi_sales`.`ss_project`, CONSTRAINT
`fk_project_product_type` FOREIGN KEY (`product_type_id`) REFERENCES
`ss_product_type` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
It also shows that the value being inserted into ss_project.product_type_id is ''. If I copy the SQL out and change it to NULL, it works. How can I have Yii set it to NULL?