DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

# Mixed types service¶

This service allows properties types to be dynamically fetched.

For instance, in a configuration object which contains a list of employees, every employee can have a different role; in this case, roles can be divided into PHP classes. This service will allow the implementation of a method that will be called to resolve which class should be used. Take a look at the example below for more information.

## Usage¶

You can activate this service for a given configuration object by attaching it to the ServiceFactory in the static function getConfigurationObjectServices(). Use the constant ServiceInterface::SERVICE_MIXED_TYPES as an identifier for this service (see example below).

You have two possibilities to use it on properties:

• Solution 1: you can use the annotation @mixedTypesResolver on the property that needs it, filled with a class name that implements the interface MixedTypesInterface.
• Solution 2: the type of the variable can be the resolver class, for instance an abstract class.