Hi all,
I have the following situation:
Table_A:
-idA
-a1
-a2
-processID (FK to a process table with only 2 entries (1 and 2)
…
Table_B:
-idB
-idA (FK)
-b1
-b2
…
Table_C
-idC
-idA (FK)
-c1
-c2
…
When I create a new record of A in actionCreate, depending on the processID (selected by user during create), if user select process1 then a record of B should also be created, and if process2 is selected then a record of C should be created…
What I nead is:
1.How to figure out which processID was selected by user, to decide which also to create (B or C)?
2.When I create the new model of B or C (depending on process selection) how do I get the idA of the new created record to insert it as a FK in the B or C that should also be created?
So I want to know how to do the following:
public function actionCreate()
{
$model=new A;
...
$model->save();
if(A.processID == 1)
$B=new B; (here I also want to know about question 2)
$B->save();
else
$C=new C;
$C->save();
}