cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Routes conflict with default value

Open pedro151 opened this issue 10 years ago • 6 comments

 $this->add (
            '/controller/:action/:int/:params',
            array (
                'action' => 1,
                'id'     => 2,
        'page' => 1 //value default 1 conflicts with action 1
            )
        )
        ->setName ( 'teste' );

Details

  • Phalcon version: 3.0
  • PHP Version: 7.0.8
  • Operating System: ubuntu 16.04

pedro151 avatar Aug 21 '16 18:08 pedro151

What you mean conflict ? What exactly is the problem ? Where is script to reproduce ? Expected and actual behavior ? Default parameter value should be setted in controller method, not in route i think.

Jurigag avatar Aug 21 '16 18:08 Jurigag

 $this->add (
            '/controller/:action/:int/:params',
            array (
                'action' => 1,
                'id'     => 2,
                'page'     => 1,

            )
        )
        ->setName ( 'Router' );

//view
{{ url(['for': 'Router',  'action':'index', 'id':51 ]) }}

result is: localhost/controller//51

 $this->add (
            '/controller/:action/:int/:params',
            array (
                'action' => 1,
                'id'     => 2,
            )
        )
        ->setName ( 'Router' );

//view
{{ url(['for': 'Router',  'action':'index', 'id':51 ]) }}

result is: localhost/controller/index/51

pedro151 avatar Aug 21 '16 19:08 pedro151

there is a conflict when setted default values on the router and passed to url

pedro151 avatar Aug 21 '16 19:08 pedro151

You should not pass default values on the router, then it should be removed functionality, not to experience unexpected results

pedro151 avatar Aug 21 '16 19:08 pedro151

but where is this functionality ? Just value of first parameter('action') is passed to page parameter, not action parameter.

Jurigag avatar Aug 21 '16 20:08 Jurigag

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

stale[bot] avatar Apr 16 '18 23:04 stale[bot]