class Account extends AbstractModelService
public function getModel($data = null)
// for a attribute model, here would be the initialization and attributes set before hydrating
return $this->hydrate($data, new Model\Account());
class Account extends AbstractDBRow
protected $properties = [
public function getFullConfig()
// load custom config service to process file based configuration
'divisionId' => [
'type' => 'smalltext',
'appearance' => 'select',
'service' => 'DivisionService',
'function' => 'getList',
'serviceFunctionTargetKey' => 'translation'
im migrating from ZF2 to Laminas. I have sometimes in the configuration for the model also services which provide dynamically values like for divisionId (and this is user dependent)
There is a functionality that the model could provide the full configuration, it calls a service (my custom config service).
And there lies the real problem, it can call any service by configuration as it was (i know this is an anti pattern and should not be done). What i know is all services a model could use.
The models can be configured also dynamically dependent on a field (like ‘type’) and get for the same object different configuration and therefore different services. This are attribute models which have to load additionally attributes (by configuration) which are also models itself. These kind of models (like a contract model which shares a bunch of basic attributes and gets its specialization by attributes) are from outside one model and behave as that.
For extending the account model i need to overwrite the account service to reach that goal, which is ok.
For getting the final configuration of a model how do i manage that i a proper way when i have all the needed services by configuration? And these configuration can be different for the same object.
And sometimes the configuration are used without an object itself.
Another problem are the attribute models, they are initialized by configuration. So they need the AttributeService to get the proper attributes loaded.
Thats why i thought if there is something like a factory i could call for instantiate a model this functionality could be done there.