Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Documentation edits for consistency and readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Dec 11, 2017
1 parent dc73ab9 commit 2f34376
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
29 changes: 15 additions & 14 deletions docs/book/codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,31 @@ $generator->generate($scanner->getClassNames());
## MVC and Expressive integration
When you are using zend-di's `ConfigProvider` or MVC `Module`, you can
obtain the generator instance from Zend ServiceManager:
When you are using zend-di's `ConfigProvider` with Expressive or consuming the
`Module` class via zend-mvc, you can obtain the generator instance from the
service manager:
```php
$generator = $serviceManager->get(\Zend\Di\CodeGenerator\InjectorGenerator::class);
```
### AoT Config Options
The service factory uses options in your `config` service, located in `['dependencies']['auto']['aot']`.
If present this can be an associative array of options to create the code generator instance.
This array respects the following keys (unknown keys are ignored):
The service factory uses options in your `config` service, located under the key
`dependencies.auto.aot`. This should be defined as an associative array of
options for creating the code generator instance. This array respects the
following keys (unknown keys are ignored):
- `namespace`: This will be used as base namespace to prefix the namespace of the generated classes.
It will be passed to the constructor of `Zend\Di\CodeGenerator\InjectorGenerator`. The default value
is `Zend\Di\Generated` if this option is not provided.
- `namespace`: This will be used as base namespace to prefix the namespace of
the generated classes. It will be passed to the constructor of
`Zend\Di\CodeGenerator\InjectorGenerator`; the default value is
`Zend\Di\Generated`.
- `directory`: The directory where the generated php files will be stored. If this value is not provided,
you have to set it with the generator's `setOutputDirectory()` method before calling `generate()`.
- `directory`: The directory where the generated PHP files will be stored. If
this value is not provided, you will need to set it with the generator's
`setOutputDirectory()` method before calling `generate()`.
Example:
Below is an example for configuring the generator factory:
Below is an example detailing configuration of the generator factory:
```php
return [
Expand All @@ -85,4 +87,3 @@ return [
],
];
```
10 changes: 6 additions & 4 deletions docs/book/cookbook/aot-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ use Zend\Di\Config;
require __DIR__ . '/../vendor/autoload.php';
// Define the source directories to scan for classes to generate
// AoT factories for
// Define the source directories to scan for classes for which
// to generate AoT factories:
$directories = [
__DIR__ . '/../src/App/src',
];
Expand All @@ -236,8 +236,10 @@ $generator = $container->get(InjectorGenerator::class);
$generator->generate($scanner->getClassNames());
```
> __Note:__ Before version 3.1 of zend-di, there is no service factory
> for the generator, so you had to create the instance manually:
> ### Manually creating a generator instance
>
> Before version 3.1, no service factory existed for the generator. Below is an
> example demonstrating manual creation of the generator:
>
> ```php
> <?php
Expand Down
6 changes: 3 additions & 3 deletions docs/book/cookbook/use-with-servicemanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ return [

## Service Factory For AoT Code Generation

zend-di also provides a factory for `Zend\Di\CodeGenerator\InjectorGenerator`. This factory
(`Zend\Di\Container\GeneratorFactory`) is also auto registered by the `Module` and
`ConfigProvider` classes for Zend MVC and Expressive.
zend-di also provides a factory for `Zend\Di\CodeGenerator\InjectorGenerator`.
This factory (`Zend\Di\Container\GeneratorFactory`) is also auto registered by
the `Module` and `ConfigProvider` classes for zend-mvc and Expressive.

0 comments on commit 2f34376

Please sign in to comment.