Hello, I have a problem when I try to save a model.
The problem is that the model with the function $model->save() Does anything, but I change the method with $model->insert(). And now works.
So, why?
if (isset($_POST['Leaves'])) {
$model->attributes=$_POST['Leaves'];
$model->creation_date = date("c");
if ($model->save()) {
if (isset($_POST['Leaves']['foto_leaves'])) {
$file = CUploadedFile::getInstance($model,'foto_leaves');
$foto = new Photo();
$foto->leaves_idleaves_parent = $model->idleaves;
$foto->insert();
$file->saveAs($foto->link);
This code works. But If I switch insert with save, now the code doesn´t work. So I don’t understand this behavior.
Anyone know, what is happening??