Skip to content

Commit

Permalink
Merge pull request #59 from gsteel/fix-line-highlights
Browse files Browse the repository at this point in the history
Reinstate line-highlights removed in #58
  • Loading branch information
gsteel authored Oct 31, 2024
2 parents c3fd9ae + 1c9ba59 commit 95d581d
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 95d581d

Please sign in to comment.