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!
Page 1 of 1
Yii just igore some codes
#2
Posted 06 March 2010 - 01:43 AM
kevin2010, on 06 March 2010 - 01:39 AM, said:
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!
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!
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
php:
foreach(array('cat', 'dog', 'cow') as $animal) echo $animal."\n";
python:
[(animal, print(animal)) for animal in ['cat', 'dog', 'cow']]
ruby:
['cat', 'dog', 'cow'].each {|animal| puts animal}
You say Tomato, I say Tomato.
#3
Posted 06 March 2010 - 04:13 AM
jayrulez, on 06 March 2010 - 01:43 AM, said:
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
give more details. You may tre ->save(false); to avoid validation if you're just testing
thanks very much.
it is caused by a field with not null propertity.
it is very good to know save(false) can disnable verification.
Share this topic:
Page 1 of 1

Help












