Skip to content

Controller Constructor called twice #1608

Open
@crxgames

Description

@crxgames
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);

Metadata

Metadata

Labels

an interesting oneThis looks like "an interesting one"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions