<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>dependency injection</title><description/><link>https://kevinquillen.com</link><language>en</language><item><title>Adding Parameters to Dependency Injected Objects</title><link>https://kevinquillen.com/adding-parameters-dependency-injected-objects</link><guid isPermaLink="false">279 at https://kevinquillen.com</guid><description>
&lt;span property=&quot;schema:name&quot;&gt;Adding Parameters to Dependency Injected Objects&lt;/span&gt;

            &lt;div property=&quot;schema:text&quot; class=&quot;text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item&quot;&gt;&lt;p&gt;In the last post, I touched on how you can define a service in your &lt;code class=&quot;highlighter-rouge&quot;&gt;mymodule.services.yml&lt;/code&gt; file and pass it parameters to configure the object when it is injected as a dependency into other classes.&lt;/p&gt;

&lt;p&gt;Following on that, I ran into a scenario where I needed to define multiple Solr cores on the servers that house the dev/qa sites, and one for staging and production. Each one would also be defined in Search API as a server, and each of the sites I am indexing would have their own index under each core per environment.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;&lt;/div&gt;
      
&lt;span rel=&quot;schema:author&quot;&gt;&lt;span lang about=&quot;https://kevinquillen.com/user/1&quot; typeof=&quot;schema:Person&quot; property=&quot;schema:name&quot; datatype&gt;Kevin&lt;/span&gt;&lt;/span&gt;

&lt;span property=&quot;schema:dateCreated&quot; content=&quot;2017-06-29T12:00:00+00:00&quot;&gt;&lt;time datetime=&quot;2017-06-29T08:00:00-04:00&quot; title=&quot;Thursday, June 29, 2017 - 08:00&quot;&gt;June 29th, 2017&lt;/time&gt;
&lt;/span&gt;
</description><pubDate>Thu, 29 Jun 2017 12:00:00 GMT</pubDate><dc:creator>Kevin</dc:creator></item><item><title>Dependency Inject PHP Classes into Drupal</title><link>https://kevinquillen.com/dependency-inject-php-classes-drupal</link><guid isPermaLink="false">280 at https://kevinquillen.com</guid><description>
&lt;span property=&quot;schema:name&quot;&gt;Dependency Inject PHP Classes into Drupal&lt;/span&gt;

            &lt;div property=&quot;schema:text&quot; class=&quot;text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item&quot;&gt;&lt;p&gt;In my latest adventures in Drupal 8, I had to build out a multisite search with Solr.&lt;/p&gt;

&lt;p&gt;While I will touch on that later, I wanted to call out something I learned today, which is how to inject dependencies to your Drupal class with non-native Drupal code.&lt;/p&gt;

&lt;p&gt;What do I mean by that?&lt;/p&gt;

&lt;p&gt;For example, while iterating over my controller for the search results page, I simply used &lt;code class=&quot;highlighter-rouge&quot;&gt;$client = new Solarium\Client();&lt;/code&gt; because I did not know how to inject that into Drupal properly.&lt;/p&gt;&lt;/div&gt;
      
&lt;span rel=&quot;schema:author&quot;&gt;&lt;span lang about=&quot;https://kevinquillen.com/user/1&quot; typeof=&quot;schema:Person&quot; property=&quot;schema:name&quot; datatype&gt;Kevin&lt;/span&gt;&lt;/span&gt;

&lt;span property=&quot;schema:dateCreated&quot; content=&quot;2017-06-20T12:00:00+00:00&quot;&gt;&lt;time datetime=&quot;2017-06-20T08:00:00-04:00&quot; title=&quot;Tuesday, June 20, 2017 - 08:00&quot;&gt;June 20th, 2017&lt;/time&gt;
&lt;/span&gt;
</description><pubDate>Tue, 20 Jun 2017 12:00:00 GMT</pubDate><dc:creator>Kevin</dc:creator></item></channel></rss>