Skip to content
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

Reinstate line-highlights removed in #58 #59

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ To register a listener in a laminas-mvc based application, use either applicatio

This example uses module configuration, e.g. `module/Application/config/module.config.php`:

```php
<!-- markdownlint-disable no-inline-html -->

<pre class="language-php" data-line="4-6"><code>
namespace Application;

return [
Expand All @@ -68,15 +70,15 @@ return [
],
// …
];
```
</code></pre>

All listeners registered in this way are fetched from the application service container.
This means the listeners must be registered for the application service container to discover and create them.

To register the listener for the application service container, extend the configuration of the module.
Add the following lines to the module configuration file, e.g. `module/Application/config/module.config.php`:

```php
<pre class="language-php" data-line="3,8"><code>
namespace Application;

use Laminas\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory;
Expand All @@ -89,7 +91,9 @@ return [
],
// …
];
```
</code></pre>

<!-- markdownlint-enable no-inline-html -->

The example uses the [reflection factory from laminas-servicemanager](https://docs.laminas.dev/laminas-servicemanager/reflection-abstract-factory/) to resolve the constructor dependencies for the listener class.

Expand Down