Yii:: Log And Model Creation Not Working When Controller Is Being Called From Ajax/json

Yii:: log and Model creation not working when Controller is being called from AJAX/JSON

I did a widget that implements and html5 uploader in my Yii APP.

The upload, and the copy of the files works great.

The call to functions as "Path Of Alias" works great too.

The problem is that saving models is not working under these conditions and I do not know why.

I started to log the variables with Yii::log and I realized that is not being called at all, or at least is not changing the content of the log file. ( It works in other controllers without trouble )

I read that someone had a similar trouble and he fixed it with Yii::app()->end(); but this is not working for me.

It seemd that every Yii function that is left for the end is not working.

Any one has any idea ? It will really appreciated !! :D

The Yii::log function started to work after I force a Yii->app()->end before each die().


 function myDie($msg)

    {

        Yii::app()->end();

        die($msg);

    }

I still have the trouble of the model that has not beeing save().

And using the following I realized that I had an error in the model.


function myLog($msg, $sufijo = "[LOG]") {

        if (is_array($msg)) {

            foreach ($msg as $key => $value) {

                if (is_array($value)) {


                    foreach ($value as $key_2 => $value_2) {

                        YII::log($sufijo . $key_2 . ":\t" . $value_2);

                    }

                } else {

                    YII::log($sufijo . $key . ":\t" . $value);

                }

            }

        } else {

            Yii::log($sufijo . $msg);

        }

    }