Services, like Query Service for example, make use of Dao and other object as strict dependecy;
actually only Daos are passed in as contructor's parametesr, when the other object are instanciated at runtime creating a too coupled design.
For example here:
the Dto object is created at runtime where it can be passed in as an arguments to the method signature.
Here, instead, the Transaction object is created in the constructor:
'cause I wanted to avoid to construct Transaction in Controller.
To avoid this bad design make use of one of:
Container Class, or Php Annotation, or a configuration file where all dependency are declared.
See
Services, like Query Service for example, make use of Dao and other object as strict dependecy; actually only Daos are passed in as contructor's parametesr, when the other object are instanciated at runtime creating a too coupled design. For example here:
https://github.com/ripliveit/riplive_admin/blob/develop/wp-content/plugins/rip-charts/services/rip-charts-query-service.php#L50
the Dto object is created at runtime where it can be passed in as an arguments to the method signature. Here, instead, the Transaction object is created in the constructor:
https://github.com/ripliveit/riplive_admin/blob/develop/wp-content/plugins/rip-charts/services/rip-charts-persist-service.php#L31
'cause I wanted to avoid to construct Transaction in Controller. To avoid this bad design make use of one of: Container Class, or Php Annotation, or a configuration file where all dependency are declared. See
https://github.com/ripliveit/riplive_admin/issues/21
for more information.