Closed Ecureuilvirtuel closed 8 years ago
For me id
is missing in your syntax :
<?php
$router->get('/supervisor', 'supervisor', 'index');
You use the get()
magic method with three arguments : pattern
, call
and able
.
But in https://github.com/hoaproject/Router/blob/master/Generic.php#L163 and https://github.com/hoaproject/Router/blob/master/Generic.php#L108-L125 we can see that the correct syntax must be something like :
get(<id>,<pattern>,<call>,<able>)
So i think you have to try something like :
<?php
$router->get('SuperVisorIndex','/supervisor','supervisor','Index')
I can't try for now but i hope it's the good answer.
It does't change anything.
"hoa/router" : "2.15.02.26", "hoa/dispatcher" : "0.15.05.29",
<?php $router = new Hoa\Router\Http(); $router->get('SuperVisorIndex', '/supervisor', 'supervisor', 'index'); $router->route('/supervisor');
echo print_r($router->getTheRule());
Uhm ok, i'll make a try with your versions of router
and dispatcher
What did you want to do exactly ? if i understood correctly you want to call the Index
method of your supervisor
class when the http://domain/supervisor
uri is called. That's it ?
It's that. I have un directory Application. Inside A directory Controller and Public. In the file Public/index.php i specify a route which redirect me to the Action index of the class Controller/SupervisorController with the url http://domain/supervisor.
Ok so you need some configuration on your dispatcher to tell it what it have to match :
try with this :
$dispatcher = new Dispatcher\ClassMethod([
'synchronous.call' => 'Application\Controller\(:call:U:)'
]);
Does it works ? @Ecureuilvirtuel
I have this configuration file for the dispatcher :
return array ( 'keywords' => array ( 'controller' => 'main', 'action' => 'main', 'method' => NULL, ), 'parameters' => array ( 'synchronous.call' => 'Application\Controller(:controller:U:)Controller', 'synchronous.able' => '(:action:U:)Action', 'asynchronous.call' => '(:%synchronous.controller:)', 'asynchronous.able' => '(:%synchronous.action:)Async', ), );
This configuration is good but the problem is still present.
There is a type in your configuration, a \
is missing before (:controller:U)
It is github which remove the "\".
:( each time i think i have found the answer ^^
Here my test :
For me everything is ok !
Good job, problem solved :
my config was wrong :
'synchronous.call' => 'Application\Controller\(:controller:U:)Controller',
'synchronous.able' => '(:action:U:)Action',
and the solution is :
'synchronous.call' => 'Application\Controller\(:call:U:)Controller',
'synchronous.able' => '(:able:U:)Action',
Thank's a lot :+1:
@Ecureuilvirtuel Can you close the issue please? @Jir4 Good job!
:bowtie: :sweat_smile:
@Hywan I can't close the issue, I have no right ...
Environnement : windows 7 PHP 5.4.34
Problem : My route is not dispatche correctly, so i speak with hywan and we try to isolate the problem with hoa/router.
So the code is :
$router = new Hoa\Router\Http(); $router->get('/supervisor', 'supervisor', 'index'); $router->route('/supervisor');
print_r( $router->getTheRule() );
The expected response :
Array ( [0] => 0 [1] => /supervisor [2] => Array ( [0] => get )
)
And my response is :
Array ( [0] => 0 [1] => supervisor [2] => Array ( [0] => get )
)