I have followed the API tutorial. http://docs.phalconphp.com/en/latest/reference/tutorial-rest.html
I have everything working.
Now I am creating an authentication function that I will call at the beginning of each api call.
Example:
$app->get('/api/robots', function() use ($app) { $authdata=isauthorized($app); ... ..
So now in the "index.php" file I have a function titled "is_authorized"
The function runs fine, however I cannot execute SQL within this function.
The following example does not execute within the is_authorized function.
$phql = "SELECT * FROM Members ORDER BY id"; $robots = $app->modelsManager->executeQuery($phql);
While the above will run within my initial api call function it does not run in the is_authorized function. Is there a way to pass "$app" to this function so that I can use it to execute queries?