-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation on the migration path from laminas-mvc-console #85
Comments
@koenkivits
Why do you need the same events for a CLI command and an application? What is being executed here? Can you give an example?
In a laminas-mvc based application the listeners can be registered via configuration (global, module, etc.), no need for a module extension: return [
'listeners' => [
MyModule\Listener\MyListener::class,
],
// …
];
👍 |
@froschdesign thanks for your quick response!
We mostly used We also logged the MVC events as event markers in Tideways. We now simply do the same with Symfony console events. Not a huge thing, but it was something we needed find out.
You're right, we can probably improve our code here, thanks. :) This doesn't seem to be mentioned in the documentation though? (I could look at documenting that too, of course) (by the way, I linked the wrong documentation. Here's the page that specifically recommends |
@koenkivits
Sounds like it doesn't belong there. Why not configuration and factories?
Refactoring is good. 😃
A topic for the migration guide.
You are right, this part is missing the documentation of laminas-eventmanager. I added a note to the related project. Thanks for your feedback and the examples! 👍 |
🤐 😅 (it's been busy here as well)
This was in an older part of our code base so it's hard to tell, but I'm not sure if it was ever a very deliberate decision at all. My guess is that the decision at the time was only based on this line
(emphasis mine) In any case: I hope to be able to take the time to write the documentation soon. I've had a busy few weeks so I haven't gotten around to it yet. 🙂 |
@koenkivits did you ever manage to write some documentation on the migration path from |
Feature Request
Summary
We're migrating our (pretty big) application from
laminas-mvc-console
tolaminas-cli
. So far I genuinely like the new setup, but the migration hasn't been trivial for us so far: we've run into some issues that might be worth documenting. Here are some things I've gathered so far:laminas-cli
does not initialize aLaminas\Mvc\Application
and therefore does not initiate the MVC application lifecycle. If your app depends on any MVC events (bootstrap, route, dispatch, etc) then this won't work for console commands.onBootstrap
method will also not be called, as it depends onMvcEvent::EVENT_BOOTSTRAP
being triggered. UsingonBootstrap
is suggested by the Laminas documentation for doing lightweight application setup like setting up event listeners (we're now usingModuleEvent::EVENT_LOAD_MODULES_POST
instead).public/index.php
is no longer the application entry point, so if you do any setup here then that will no longer work. The docs for the MVC skeleton suggest to add some error reporting here, so it might be good to explicitly mention warn about this in thelaminas-cli
docs.There might be more, but this is what I could come up with now. I'd be willing to create a documentation PR by the way, I just figured it was better to file an issue first. :)
The text was updated successfully, but these errors were encountered: