kevin2010
(Kevin2010)
1
hi, all
i have this action in Controller_photos :
$model=new Photos;
$photocate = new Photocate;
$photocate->title=‘test’;
$photocate->save();
$model->photocate_id=$photocate->id;
$model->save()
no errors after running.
i checked the database, i can see one new record in table_photos, nothing is in table_photocate.
really strange, Yii just igore these codes:
$photocate = new Photocate;
$photocate->title=$event->title;
$photocate->save();
can someone help me, thanks!
jayrulez
(Waprave)
2
What is the relationship between your models. Are your tables innodb with constraints?
give more details. You may tre ->save(false); to avoid validation if you’re just testing
kevin2010
(Kevin2010)
3
thanks very much.
it is caused by a field with not null propertity.
it is very good to know save(false) can disnable verification.