ripliveit / riplive_admin

The administrative back end application of riplive.it, powered by Wordpress
Other
3 stars 0 forks source link

Bug / Feature: Pass all dependency in construction to services. #24

Closed gabrieledarrigo closed 9 years ago

gabrieledarrigo commented 9 years ago

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.

gabrieledarrigo commented 9 years ago

Closed. Use Pimple to make DI.