Hi Everyone,
I have a problem with Yii Framework.
public function doRestCreate($data)
{
$model = $this->getModel();
$ids = $this->saveModel($model, $data);
$this->renderJson($ids);
}
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.
Page 1 of 1
Return Id Auto Increment How return Object with Auto Increment Field ID?
#2
Posted 28 January 2013 - 04:37 AM
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 getLastInsertID()
Hope this will help.
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 getLastInsertID()
Hope this will help.
#3
Posted 08 February 2013 - 05:13 PM
/* moved to General Discussion */
(not a tip, snippet or tutorial)
(not a tip, snippet or tutorial)
Share this topic:
Page 1 of 1

Help














