zendframework / zend-expressive-swoole

Swoole support for Expressive applications
BSD 3-Clause "New" or "Revised" License
158 stars 14 forks source link

StartCommand assumes project is using the programmatic approach #51

Closed acelaya closed 5 years ago

acelaya commented 5 years ago

I'm trying to add zend-expressive-swoole ^2.0 to an existing expressive project, and it fails when running the start command with the error Fatal error: require(): Failed opening required 'config/pipeline.php'.

I have checked the StartCommand code and seen that it always tries to require both config/pipeline.php and config/routes.php.

Since my project is configuration based, it fiails because those files do not exist.

Is this behavior intended? If not, I could provide a PR which makes sure the command checks those files exist before trying to require them.

acelaya commented 5 years ago

By the moment I have just workaround this by creating those files returning a dummy empty function.

geerteltink commented 5 years ago

Related to these lines:

https://github.com/zendframework/zend-expressive-swoole/blob/afc917244fa6b701b728fca0cb6f78c2c96767f8/src/Command/StartCommand.php#L95-L98

The pipeline and routes config are always loaded. They should only load if those files exist. Better yet, there should be a separate check for each in case someone mixes configuration-driven and programmatic pipelines and routes.

@acelaya If you want you can create a PR.

acelaya commented 5 years ago

Sure!

acelaya commented 5 years ago

Just provided a PR, #52