Commit c42f023a authored by MikeyMJCO's avatar MikeyMJCO
Browse files

Apply 4 suggestion(s) to 1 file(s)

parent 0d81c69f
......@@ -6,7 +6,7 @@ The cached configuration container in your extension could be used to store any
Configuration could be anything, such as custom groups, custom fields, activity types, case types etc...
The cached configuration container is an on the fly generated php file and stored in the _templates_c_ folder of your civicrm installation. We don't need any extra database calls to retrieve the configuration it is all in code and therefore very fast to load.
The cached configuration container is an on the fly generated PHP file and stored in the `templates_c` folder of your CiviCRM installation. We don't need any extra database calls to retrieve the configuration it is all in code and therefore extremely fast to load.
In this guide we create a basic container for relationship types and for a custom group and a custom field.
......@@ -20,7 +20,7 @@ When no cached config container exists one is created and then the following hap
**Creating a config container instance**
An instance of the _config container_ is created by checking if the php file exists in the _templates_c_ folder.
An instance of the _config container_ is created by checking if the PHP file exists in the `templates_c` folder.
If it exists then it is included and the config container object is created.
**Requirements**
......@@ -33,7 +33,7 @@ We need two files:
## Create the config container skeleton
First we need to create the skeleton of the config container.
The config container extends the [symfony dependency injection](https://symfony.com/doc/current/components/dependency_injection.html) `Container` class this makes it easier to store it in a php file.
The config container extends the [symfony dependency injection](https://symfony.com/doc/current/components/dependency_injection.html) `Container` class, this makes it easier to store it in a PHP file.
```php
namespace \Civi\MyExtension;
......@@ -149,7 +149,7 @@ Next we define a `getInstance` function where all the magic happens:
2. In the next bit we define the filename in `$file`. The filename contains an ID of the environment.
3. If the file `$file` exists we will include it and create and return an instance of `MyCachedConfigContainer`, which is a sub class of `ConfigContainer`.
4. In the next bit we will build and create the file `$file`. We do this by creating a new `ContainerBuilder` class and pass this to our earlier defined `build` function of `ConfigContainer` class.
5. Lastly we will write the `ContainerBuilder` to the php file (`$file`) with the `PhpDumper` class. We state that we want to call the class `MyCachedConfigContainer` and that it is a subclass of `ConfigContainer`.
5. Lastly we will write the `ContainerBuilder` to the PHP file (`$file`) with the `PhpDumper` class. We state that we want to call the class `MyCachedConfigContainer` and that it is a subclass of `ConfigContainer`.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment