Answer the question
In order to leave comments, you need to log in
Yii 1 how to get returning id?
the better
$this->primaryKey = Yii::app()->getComponent($dbComponent)->getLastInsertID($this->sequence());
$id_analiz = Yii::app()->db->createCommand()
->select("currval('a_analiz_create_id_seq1')") //получаем ид вставленной записи
->queryScalar();
Answer the question
In order to leave comments, you need to log in
I don’t quite understand for what purpose you are doing this, but in theory, after saving the ActiveRecord, the result of the insertion will be stored in its primirayKey (s):
$model = new Test();
$model->some_field = 'test';
$model->save();
var_dump($model->primaryKey);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question