I try to find this in internet but I not yet find the answer. hope I can find it here.
Thanks
$conn = ConnectionManager::get('default'); $result = $conn->execute("call procedure_name()")->fetchAll('assoc');
1 Like
Thanks, but can you tell me what do we need to include in our controller in order to use ConnectionManager?
(like use Cake\Network;)
Bellow namespace App\Controller;
add use Cake\Datasource\ConnectionManager;
1 Like
Thanks, and how about stored procedure have 2 or 3 Parameters, how we pass the values to the Parameters?
Thanks, again
Like this ----> http://bfy.tw/6uer
3 Likes
use Cake\Datasource\ConnectionManager;
public function yourFunctionInClass($param1, $param2)
{
$conn = ConnectionManager::get('default');
$result = $conn->execute("call procedure_name_here($param1, $param2)")->fetchAll('assoc');
}
1 Like