PPI Routing integration with Aura Router - Some Questions

62 views
Skip to first unread message

Paul Dragoonis

unread,
May 5, 2015, 8:02:20 AM5/5/15
to aur...@googlegroups.com
Hi Aura'ers,

1. How do I tell the Aura router to generate in relative or absolute path ?

Symfony Router has the following signature for url generation

interface UrlGeneratorInterface

public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH);

Looking at Aura's it is the following:
public function generate($name, $data = array())

I've checked the docs and there's no mention of it - https://github.com/auraphp/Aura.Router/tree/2.2.2#generating-a-route-path


2. Extracting the dispatch information out of a route.

What's typical in the "Aura Framework" for users to define what controller/action they would like to have dispatched for them by the framework? As someone who doesn't user the Framework itself this ?

From one of your Router examples i found this. Is this how all Aura Framework users set the desired controller/action class?
->addValues(array( 'action' => 'BlogReadAction'));


More will come - but that's good for now.



Hari K T

unread,
May 5, 2015, 9:28:08 AM5/5/15
to aur...@googlegroups.com
Hi Paul D,

1. How do I tell the Aura router to generate in relative or absolute path ?

Symfony Router has the following signature for url generation

interface UrlGeneratorInterface

public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH);

Looking at Aura's it is the following:
public function generate($name, $data = array())

I've checked the docs and there's no mention of it - https://github.com/auraphp/Aura.Router/tree/2.2.2#generating-a-route-path

 
I don't think, there is no relative / absolute path in Aura. Only one as you would have noticed in the example.

So if a route is added with name it can generate the path from the route name and given params. iirc symfony can add domain name that may be why it have absolute path ?
 
2. Extracting the dispatch information out of a route.

What's typical in the "Aura Framework" for users to define what controller/action they would like to have dispatched for them by the framework?

Aura framework uses one class per action per route. It makes use of Aura.Dispatcher internally.
 
As someone who doesn't user the Framework itself this ?

 
From one of your Router examples i found this. Is this how all Aura Framework users set the desired controller/action class?
->addValues(array( 'action' => 'BlogReadAction'));

and you need to define in the dispatcher also. See full stack example https://github.com/auraphp/Aura.Web_Project#full-stack-style

I did created an example earlier with router and dispatcher : https://github.com/harikt/router-dispatcher/blob/master/web/index.php

Hari K T

You can ring me : +91 9388 75 8821

Skype  : kthari85
Twitter : harikt

Paul Dragoonis

unread,
May 5, 2015, 10:59:55 AM5/5/15
to aur...@googlegroups.com
Hi Hari,


On Tuesday, 5 May 2015 14:28:08 UTC+1, Hari K T wrote:
Hi Paul D,

1. How do I tell the Aura router to generate in relative or absolute path ?

Symfony Router has the following signature for url generation

interface UrlGeneratorInterface

public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH);

Looking at Aura's it is the following:
public function generate($name, $data = array())

I've checked the docs and there's no mention of it - https://github.com/auraphp/Aura.Router/tree/2.2.2#generating-a-route-path

 
I don't think, there is no relative / absolute path in Aura. Only one as you would have noticed in the example.

So if a route is added with name it can generate the path from the route name and given params. iirc symfony can add domain name that may be why it have absolute path ?

So it's safe to assume that Aura doesn't support the generation of absolute paths, can you confirm ?
 
 
2. Extracting the dispatch information out of a route.

What's typical in the "Aura Framework" for users to define what controller/action they would like to have dispatched for them by the framework?

Aura framework uses one class per action per route. It makes use of Aura.Dispatcher internally.
 
As someone who doesn't user the Framework itself this ?

 
From one of your Router examples i found this. Is this how all Aura Framework users set the desired controller/action class?
->addValues(array( 'action' => 'BlogReadAction'));

and you need to define in the dispatcher also. See full stack example https://github.com/auraphp/Aura.Web_Project#full-stack-style

I did created an example earlier with router and dispatcher : https://github.com/harikt/router-dispatcher/blob/master/web/index.php

I won't be using the Aura.Dispatcher, but it's good to see what implicit decisions it's making. I see that if you provide it with an object it will try to call __invoke() on it.

This is fine, I have AuraRouting system now integrated into PPI Routing system. It makes the decision that in your 'controller' or 'action' route params if you provide an object and that object has __invoke() on it, then it will consider it as a controller and dispatch it.

Is this an accurate rule to make?

Since I'm passing your controller/action param over to Symfony ControllerResolver then, within PPI, you can specify 2 alternative names to your controllers.

$router->add('Homepage', '/')
    ->addValues(array(
        'controller' => 'Application:Index:index’
    ));

$router->add('Homepage', '/')
    ->addValues(array(
        'controller' => 'Application\Controller\Index::indexAction'
    ));

Hari K T

unread,
May 5, 2015, 1:04:06 PM5/5/15
to aur...@googlegroups.com
Hi

1. How do I tell the Aura router to generate in relative or absolute path ?

Symfony Router has the following signature for url generation

interface UrlGeneratorInterface

public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH);

Looking at Aura's it is the following:
public function generate($name, $data = array())

I've checked the docs and there's no mention of it - https://github.com/auraphp/Aura.Router/tree/2.2.2#generating-a-route-path

 
I don't think, there is no relative / absolute path in Aura. Only one as you would have noticed in the example.

So if a route is added with name it can generate the path from the route name and given params. iirc symfony can add domain name that may be why it have absolute path ?

So it's safe to assume that Aura doesn't support the generation of absolute paths, can you confirm ?

That is what I am aware of.
 
 
2. Extracting the dispatch information out of a route.

What's typical in the "Aura Framework" for users to define what controller/action they would like to have dispatched for them by the framework?

Aura framework uses one class per action per route. It makes use of Aura.Dispatcher internally.
 
As someone who doesn't user the Framework itself this ?

 
From one of your Router examples i found this. Is this how all Aura Framework users set the desired controller/action class?
->addValues(array( 'action' => 'BlogReadAction'));

and you need to define in the dispatcher also. See full stack example https://github.com/auraphp/Aura.Web_Project#full-stack-style

I did created an example earlier with router and dispatcher : https://github.com/harikt/router-dispatcher/blob/master/web/index.php

I won't be using the Aura.Dispatcher, but it's good to see what implicit decisions it's making. I see that if you provide it with an object it will try to call __invoke() on it.

This is fine, I have AuraRouting system now integrated into PPI Routing system. It makes the decision that in your 'controller' or 'action' route params if you provide an object and that object has __invoke() on it, then it will consider it as a controller and dispatch it.

Is this an accurate rule to make?

Since I'm passing your controller/action param over to Symfony ControllerResolver then, within PPI, you can specify 2 alternative names to your controllers.

$router->add('Homepage', '/')
    ->addValues(array(
        'controller' => 'Application:Index:index’
    ));

$router->add('Homepage', '/')
    ->addValues(array(
        'controller' => 'Application\Controller\Index::indexAction'
    ));

I am not sure on PPI integration.  Are you looking for any module that work on Aura to work on PPI? Else eveything should work the way your controller knows how to handle from the router params .

Thank you.
Reply all
Reply to author
Forward
0 new messages