Integration action traits
As opposed to local action traits and extension action traits, integration action traits apply only to initializable and setupable objects. They are normally used for piping other actions at the end of the current one, if the current action is completed successfully.
They are similar to the extension action traits but have a few notable differences:
  • Their methods are always prefixed with integrate_.
  • The methods are called after the extension traits.
  • The methods can return a different exception type so, in case of failure, the result may be wrapped in an exception of the proper type.
  • The integration traits inherit different corresponding traits.
Let's use as an example the default InitializableTrait that you can find here. If you check the initialize method, all the points above should be obvious by looking at the second elseif statement.
A good example of an integration trait is the SetupOnInitializationTrait which automagically calls the setup method of an object that initialized successfully and is also setupable.
The Foundations module comes with a few pre-built piping actions. Make sure to check them out on GitHub for the initializable objects here and for the setupable objects here.
Copy link