You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/generator/custom/customPostProcessor.rst
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ What can you do inside your custom post processor?
28
28
29
29
* Add additional traits and interfaces to your models
30
30
* Add additional methods and properties to your models
31
+
* Add PHP attributes to the generated class or to individual properties (see `PHP Attributes`_ below)
31
32
* Hook via **SchemaHooks** into the generated source code and add your snippets at defined places inside the model:
32
33
33
34
* Implement the **ConstructorBeforeValidationHookInterface** to add code to the beginning of your constructor
@@ -44,3 +45,61 @@ What can you do inside your custom post processor?
44
45
This behaviour also applies also to properties changed via the *populate* method added by the `PopulatePostProcessor <#populatepostprocessor>`__ and the *setAdditionalProperty* method added by the `AdditionalPropertiesAccessorPostProcessor <#additionalpropertiesaccessorpostprocessor>`__
45
46
46
47
To execute code before/after the processing of the schemas override the methods **preProcess** and **postProcess** inside your custom post processor.
48
+
49
+
PHP Attributes
50
+
--------------
51
+
52
+
You can attach PHP 8.0 `attributes <https://www.php.net/manual/en/language.attributes.overview.php>`__ to the generated class and to individual properties using **PHPModelGenerator\\Model\\PhpAttribute**.
53
+
54
+
**Class-level attribute** (placed before the ``class`` keyword in the generated file):
55
+
56
+
.. code-block:: php
57
+
58
+
use PHPModelGenerator\Model\PhpAttribute;
59
+
use PHPModelGenerator\SchemaProcessor\PostProcessor\PostProcessor;
60
+
61
+
class ORM_EntityPostProcessor extends PostProcessor
62
+
{
63
+
public function process(Schema $schema, GeneratorConfiguration $generatorConfiguration): void
0 commit comments