Return Id Auto Increment

Hi Everyone,

I have a problem with Yii Framework.

public function doRestCreate($data)


$model = $this->getModel();

$ids = $this->saveModel($model, $data);



I can return this model(ID =0, Name = Test) my ID Field in database is auto increment, so I want to get create object include ID (get from ID field auto increment).

Please help me to create it.

Hi rith thy,

I didn’t understand in details what’s your exact problem according to the code provided. But in common, when you save the model, ID is available right after that as usual, $model->id. In addition, you may use [url=""]getLastInsertID/url

Hope this will help.

/* moved to General Discussion */

(not a tip, snippet or tutorial)