Interpreting Tracy route informaion

Bill Lions
Member | 47
+
0
-

In my route to url /contact, Tracy reports
redirect App\Router\contactRouter Contact:Default id = null

If then forwards to
App\Router\portfolioRouter Portfolio:default id = null

But gives no reason for the redirect.
Is Tracy able to give greater verbosity? Or is there another solution for visibility of redirects?
Router code below.

Contact Router

declare(strict_types=1);

namespace App\Router;

use Nette;
use Nette\Application\Routers\RouteList;


class contactRouter implements Nette\Application\IRouter
{
        public $defaults = [];

        public function __construct(array $defaults = [])
        {
                $this->defaults = $defaults;
        }


        /**
         *
         * @access      public
         * @param       Nette\Http\IRequest     $httpRequest
         * @return      array
         *
         */
        function match(Nette\Http\IRequest $httpRequest): ?array
        {
                $url = $httpRequest->getUrl()->getPathInfo();
                $path = pathinfo( $url );

                switch( $url )
                {
                        case 'contact':
                                return ['presenter'=>'Contact',
                                        'action'=>'Default',
                                        'id'=>null
                                ];

                        default:
                                return null;
                }
        }


        /**
         * constructUrl
         * @access public
         * @param       array   $params
         * @param       Nette\Http\UrlScript    $refUrl
         * @return      string
         *
         */
        function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?string
        {

                $auth = $refUrl->getAuthority();
                $scheme = $refUrl->getScheme();
                $action = $params['action'];

                switch( $action )
                {
                        case 'default':
                                return $scheme.'://'.$auth.'/contact';
                                return $scheme.'://'.$auth.'/contact';

                        default:
                                return null;
                }
        }
}

And the portfolio router:

declare(strict_types=1);

namespace App\Router;

use Nette;
use Nette\Application\Routers\RouteList;


class portfolioRouter implements Nette\Application\IRouter
{
        public $defaults = [];

        public function __construct(array $defaults = [])
        {
                $this->defaults = $defaults;
        }

        /**
         *
         * @access      public
         * @param       Nette\Http\IRequest     $httpRequest
         * @return      array
         *
         */
        function match(Nette\Http\IRequest $httpRequest): ?array
        {
                $url = $httpRequest->getUrl()->getPathInfo();
                $path = pathinfo( $url );

                switch( $url )
                {
                        case 'portfolio':
                                return ['presenter'=>'Portfolio',
                                        'action'=>'default',
                                        'id'=>null
                                ];

                        default:
                                return null;
                }
        }

        /**
         * @access public
         * @param       array   $params
         * @param       Nette\Http\UrlScript    $refUrl
         * @return      string
         *
         */
        function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?string
        {
                $auth = $refUrl->getAuthority();
                $scheme = $refUrl->getScheme();
                $action = $params['action'];

                switch( $action )
                {
                        case 'default':
                                return $scheme.'://'.$auth.'/portfolio';

                        default:
                                return null;
                }
        }
}

Last edited by Bill Lions (2020-07-21 01:39)