Answer the question
In order to leave comments, you need to log in
Where to place calls to stored procedures in yii?
For work with tables I use ActiveRecord. But the inheritance inherited a base in which part of the work with tables goes through procedures. How/where is it architecturally best to place calls to stored procedures in the code? And how to work if, for example, part of the queries to the table will go through the ORM, and part through the procedures?
Answer the question
In order to leave comments, you need to log in
Use the repository and write there even in SQL, even in AR
And already there you call something like this:
$result = \Yii::$app->db->createCommand("CALL coverage_dis_prof(@r,:prof, :dis);")
->bindValue(':prof' , 2)
->bindValue(':dis', 31)->execute();
$rez=Yii::$app->db->createCommand("SELECT @r;")->queryScalar();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question