Controller Constructor called twice
- Dominant language
- PHP
- Stars
- 9.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
| Q | A
| ----------------- | ---
| Bug? |yes
| New Feature? | no
| Framework | Laravel
| Framework version | 5.3+
| Package version | 2.0.0-alpha1
| PHP version | 7.2.11
#### Actual Behaviour
My controller constructors are being called twice. It appears that there are two different instantiations of the Controller taking place upon execution.
#### Expected Behaviour
One instance of controller being instantiated.
#### Steps to Reproduce
1. Laravel 5.7 installation + dingo 2.0.0-alpha1
2. Create new controller and define a constructor with an echo statement
3. Add route to new controller method.
4. Load page at route defined above. You will see constructor output twice.
#### Possible Solutions
This is probably not correct, but currently I have had to convert Route.php line 283 to:
$this->container->instance($this->controllerClass, $this->controller);
Contributor guide
Assessment
This issue has not been assessed yet.