-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No action or controller set for view in v1.2.4 #1275
Comments
This is not a bug, $this->view->getActionName() and $this->view->getControllerName() aren't populated there, these methods only return data if the View is currently rendering a view. You can use echo $this->dispatcher->getActionName() and echo $this->dispatcher->getControllerName() |
Unfortunately in 1.2.4 is doesn't even render the appropriate view though. I have had to rollback to 1.2.3 to get it to work. Am I missing something? |
That could be a bug, can you please submit a test to reproduce the problem?, Currently we have the forum and the main website running with 1.2.4 and the views are properly rendered. Also that version is passing all the tests on Travis: https://travis-ci.org/phalcon/cphalcon/builds/11691271 |
It looks like it could be a combination of multi-module and Annotations that cause it. When I get change I will replicate with a test |
OK - still haven't had chance to work on a test but this is a definite bug and can re-produce quickly: Using multi-module so I have done addModuleResource on the router Using the following code:
Results:
However if I change the @RoutePrefix on the controller to '/Hello' on 1.2.4 it shows the correct Controller name |
Test case: <?php
/**
* @RoutePrefix("/hello")
*/
class HelloController extends \Phalcon\Mvc\Controller
{
/**
* @Get("/test")
*/
public function testAction()
{
echo $this->dispatcher->getControllerName(), PHP_EOL;
}
}
$di = new \Phalcon\DI\FactoryDefault();
$di->setShared('view', function() { return new \Phalcon\Mvc\View(); });
$di->setShared('router',
function()
{
$router = new \Phalcon\Mvc\Router\Annotations(false);
$router->setUriSource(Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI);
$router->addResource('Hello');
return $router;
}
);
$application = new \Phalcon\Mvc\Application($di);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/hello/test';
echo $application->handle()->getContent();
?> |
Huge thanks for fixing this. We need a phalcon-con so I can buy you a beer! |
Using latest source (1.2.4) routes created with Annotations do not configure the action or controller options within the view. Have not confirmed if it relates to multi-module setup, but to reproduce:
In controller:
The route has been matched but both variables are not populated with the action or controller names. Replicated and works fine in 1.2.3.
The text was updated successfully, but these errors were encountered: