Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phalcon - Calling function from other controller

How to call function from another controller in Phalcon PHP framework. Here is example for CakePHP http://sherwinrobles.blogspot.com/2013/02/cakephp-calling-function-from-other.html

like image 610
booldog Avatar asked Apr 10 '26 16:04

booldog


1 Answers

Based on the link you provided, to my knowledge there is no direct way to call a function in another controller using the request object. However instantiating the controller and calling the function will work just it does in CakePHP

$newController = new \MyNS\Controllers\NewController();
$newController->myFunc();

If you want you can use a static function inside the controller and call it

\MyNS\Controllers\NewController::myFunc();
like image 194
Nikolaos Dimopoulos Avatar answered Apr 12 '26 06:04

Nikolaos Dimopoulos