Skip to content

Commit

Permalink
fixing various bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ipranjal committed May 14, 2018
1 parent 688fc60 commit 0b3191f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/ArgumentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

namespace Scrawler\Router;
use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface;
use Symfony\Component\HttpFoundation\Request;

class ArgumentResolver implements ArgumentResolverInterface {

public function getArguments(Request $request, $controller=null){
$arguments=$request->attributes->get('__arguments');
$arguments=$request->attributes->get('_arguments');
return explode(",",$arguments);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ControllerResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseResolver;
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;

class ConrollerResolver extends BaseResolver implements ControllerResolverInterface {
class ControllerResolver extends BaseResolver implements ControllerResolverInterface {

}
13 changes: 6 additions & 7 deletions src/RouterEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,13 @@ public function route() {

//Sets the Request attribute according to the route
if (class_exists($this->controller)) {
$controller = $this->controller();
$this->method = $this->getMethod($controller);
$this->request->attributes->set('__controller',$controller.'::'.$method);
$this->method = $this->getMethod($this->controller);
$this->request->attributes->set('_controller',$this->controller.'::'.$this->method);
} else {
$controller = $this->collection->getNamespace().'\Main';
$this->controller = $this->collection->getNamespace().'\Main';
array_unshift($this->path_info, '');
$this->method = $this->getMethod($controller);
$this->request->attributes->set('__controller',$controller.'::'.$method);
$this->method = $this->getMethod($this->controller);
$this->request->attributes->set('_controller',$this->controller.'::'.$this->method);

}
$this->setArguments();
Expand Down Expand Up @@ -142,7 +141,7 @@ private function setArguments() {
$this->error('Not enough arguments given to the method');
} else {
//set arguments
$this->request->attributes->set('__arguments',implode(",",$arguments));
$this->request->attributes->set('_arguments',implode(",",$arguments));

}
}
Expand Down

0 comments on commit 0b3191f

Please sign in to comment.