Q:

Inject service with multiple construct parameters?

I've passed the dbal connection from a controller to a class that performs a large number of queries and calculations, as in
$conn = $this->get('database_connection');
$stats = new Statistics($conn, $criteria);

Is this proper?  Creating a service for the connection doesn't seem to help since I need to call the class with two parameters.  Is there a better or more proper way to achieve the same end? This method at least works.

A:

Do you have control over the Statistices class?  
If so then remove criteria from the constructor and either implement an setCriteria method or pass the criteria in as part of your getResults or whatever method.
What @Venu shows you was hot to pass data using a parameters.  If your criteria array can be setup in advance then you could use it.  But I'm guessing that criteria is built during the request.
And there is no requirement that Statistic becomes a service.  Just makes things a bit easier.  So if you are happy with your existing code then don't worry about it.  Just means that you need to grab to connection object whenever you want to make one.  And it means that if you do need to inject other objects then your code will have to be changed.

