This questions is probably best explained with some code snippets. First I create the factory method in the pimple container to create or return the Blah object:
$container['blah'] = $container->factory(function ($c) {
return new Blah();
});
Then later in my controlling code:
$blah = $this->container->get('blah');
However, Blah has the following constructor:
public function __construct($some, $constructor, $arguments) {
// .. etc
}
Is there a way I can pass in these arguments when getting Blah from the container? Many PHP classes have constructor arguments that are only really relevant at 'run time', rather than when bootstrapping your application.
I'm sure there's a simple way to do this, or I'm doing it totally wrong..