Your factory should implement the interface in your initializer.

array(
    'factories' => array(
        'solrconfig' => 'Solr\Config\ConfigInitializer',
    ),
    'initializers' => array(
         function ($instance, $sm) {
              if ($instance instanceof Configaware) {
                   $instance->setConfig($sm->get('solrconfig'));
              }
         }
    )
)


On Mon, Dec 9, 2013 at 10:24 AM, Xander Guzman
<thesha...@shadowpedia.info>wrote:

> Like the database configurations I have multiple Solr configurations so I'm
> trying to create a factory that can return the connection to the one
> specified.
>
> return array(
>     "solr" => array(
>         'media' => array( /** config */ ),
>         'vendors' => array( /** config */ ),
>     ),
> );
>
> Right now, in my module, I have the Following configuration for the
> getServiceConfig method
>
> return array(
>     'factories' => array(
>         'Solr\Service' => 'Solr\Service\Factory',
>         'Solr\Client' => 'Solr\Client\Factory',
>     ),
>     'initializers' => array(
>         'SolrConfig' => 'Solr\Config\ConfigInitializer',
>     ),
> );
>
> Here is how things are working.
>
> The factories work and are getting called and the initializer is being
> called, but the initializer isn't being called on the factories.
>
> So first, why? Is this by design? Am I misunderstanding how this
> relationship works?
>
> How can I get the same kind of multiple configurations to work I tried
> digging through the DB ones but I don't think I've found the class that yet
> reads the config to pass off to a specific adapter.
>
> Any help is appreciated.
>
> Cheers!
>
> Xander
>

Reply via email to