Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to pass named_params in HMVC
  • How to pass named_params like the Route doing?

    Do I have to modify the property directly?
    $r = Request::forge('xxxx');
    $r->named_params = array(...);


    If I follow http://fuelphp.com/docs/general/hmvc.html , with argument(s) on function execute:
    $widget = Request::forge('mymodule/mycontroller/mymethod/parms', false)->execute(array($id));

    The method have to be:
    public function mymethod($param1, $param2 = null) {...}

    The $param2 is optional. If $param1 is not provided, the value of $param2 will go to $param1.
  • ->execute(array('myparm' => $myvalue));
  • No, there is not working.

    I tried:

    //note that the $route is false
    return Request::forge('xxx', false)->execute( array( 'id' => $id ) )->response();

    but the destination controller do not have any param:

    var_dump( $this->params() );
    # null

    Instead, if I put argument variable:

    public function action_xxx($id1 = null, $id2 = null) { ... }

    $id1 and $id2 will have the value of the params.


    I tried to read line by line from Request, Router and Route and I found that it didn't generate named_params when set $route = false in Request::forge(). Instead, "method_params" contains the values.
  • HarroHarro
    Accepted Answer
    Sorry, missed that this was about "named" params.

    Only option is to set them directly in the $named_params property, there is no setter for it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion