unable to save data

I am making the create user profile page in my application

1)i am unable to get the last inserted isd of some another model like

2)Is it possiblle to save another model in one model…

3)Please I am unable to understang the usage of clsses(inbuilt) because in documentation only the titles are given not examples

4)Please give some examples of components,behaviours,widgets etc that how can we use themmmmmmmmmmmmmmmmmmmmmmmmmmmmm…I ope it is not irritating to ask so many of questions as ity’s only been a week and two that i have started yiiiiiiiiiiii

Please help me outttttttttt

NOTE: moved topic to proper section (General Discussion instead of Yii Project Site)

Well it’s not really good to post too many question at once… as you will never get all the answers at once… so it’s better to go step by step…

And don’t forget to first search the forum as there are already many topics covered and solved (like getting the last inserted id)

As you are new to Yii… first of all check the Definitive Guide to Yii… and then the Blog tutorial… there you will get some examples…

After that you can check some extensions to see how components/behaviors and widgets are done and used…

i have checked nut not found a good exmaple and explaination of widgets behaviors and components

Hi,

$latestKey = $this->primaryKey;

apply this after the save(), it was the latest insert primary key value

thanks…but if I want to get the last inserted id of some another model rather than the current using model

example:

I am using user model but want to get the last indert id of post model …is it possible

Normally when i do insert in many models and have to memorize the last insert, maybe you can store it in and variable first. Example like this:

$memberLastId = $modelMember->insertData($data);

$projectLastId = $modelProject->insertData($data2);

thanks but doesnot work :(

I think is better you show me your controller & model code :)

Thanks I solved it :

by using simple command

$lastinsertedid=SecurityQuestions::model()->findAll(array(‘limit’=>‘1’,‘order’=>‘id desc’));

foreach($lastinsertedid as $last)

{

$lastid=$last->id;

}

where SecurityQuestions is another model than the current model…Can you please explain me the question asked by me about the components,behaviors.widgets and components…I have only tried up with extensions and when I extend my behavior with

CActiveRecordBehavior it gives an error of

onafterConstruct not defined

Thanks in advance

I’m still new in this framework, for this question. I don’t think i am able to answer you correctly. You might wait for pro to answer your question :)

thanks :)

any one for expalinong me the inbulit classes of yii please