Json Encode Of Relational Query Not Working


$model = new FuelTank();

$result = $model->with("fuelType")->findAll($criteria);

echo CJavaScript::jsonEncode($result);

The above code is only encoding the rows of fuel_tank table not the fuel_type table.

I need this because I am using ajax request to populate data in my table.

Please help.

Is the result the same when you use CJSON::encode()?

Currently Yii’s json encode does not support relations.

There were some axtensions, although, doing this.

@Roman Solomatin : yes

@ORey : Can you please tell me the names and link of those extensions.

http://www.yiiframework.com/extension/ejsonbehavior/ and some others, see tags.

I haven’t tried none of these, btw, so use it on your risk.