Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Controller method with custom params (ids parameters excluded) throw Too few arguments Exception #128

Description

@brodalee
  • PHPRouter version: @Dev-Master
  • PHP version:
  • Exact steps to cause this issue
    1. Create abstraction of router.
    2. Create controllers with customs params and at first the id, and load routes.
    3. Sending request.
  • What you expected
    • e.g. I expected to get my custom params with the id.
  • What happened instead
    • e.g. Instead, I got Error : Too few arguments to function Controller::test(), 1 passed and exactly 2.

Hey ! just found an exception about controllers method params. I wanted to pass (with or without url dynamic param) some custom object like a RequestObject.

To fix it, in Router.php, match() function, just before call $routes->setParameters($params);, add

foreach ($routes->getParameters() as $parameter) {
           $params[] = $parameter;
}

Thanks you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions