Yii2 with OCI Cursor

What is the correct way to execute this code in Yii2?

1 - I get the resource rather than the object for the DB $connection. I’m trying to create an oracle cursor and have tried this below. I can get my query to work in plain PHP, but not sure of the correct way for Yii.

2 - Will the bindParam() for the cursor work? There’s not a lot of stuff around Oracle and PHP in general, most is legacy code and even less for Yii2 and Oracle.

// set cursor

$refcur = oci_new_cursor(Yii::$app->db->open());


$data = Yii::$app->db->createCommand($q)

      ->bindParam(':I_YEAR', $s, PDO::PARAM_INT)

       // will this line below work with Yii2?

      ->bindParam(':RC', $refcur, NULL, -1, OCI_B_CURSOR)


Hey There,

Yes this is the way we have to do…

Cheers! Happy coding!