Skip to content

Commit

Permalink
Reinstate line-highlights removed in #58
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <george@net-glue.co.uk>
  • Loading branch information
gsteel committed Oct 31, 2024
1 parent c3fd9ae commit 1c9ba59
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 1c9ba59

Please sign in to comment.