<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 19 May 2013 23:00:47 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Reddit.com: Dependency injection in ZF2 and Symfony 2 are service locators]]></title>
      <guid>http://www.phpdeveloper.org/news/19468</guid>
      <link>http://www.phpdeveloper.org/news/19468</link>
      <description><![CDATA[<p>
On Reddit's PHP section there's a discussion happening about <a href="http://www.reddit.com/r/PHP/comments/1caidn/dependency_injection_in_zf2_and_symfony_2_are/"> dependency injection versus service locators</a> in two popular PHP frameworks - Zend Framework 2 and Symfony 2 (and how they're not really DI at all).
</p>
<blockquote>
Both ZF2 and Symfony 2 offer the same behavior: if I'm in a controller, and I want to use a service, I have to get it from the container with $this->get('my_service').
As such, the controller is not using DI, this is the service locator pattern. Controllers become more difficult to tests because of that, and they depend on the container now. I wonder why both frameworks didn't go further: why not treat controllers like services and use dependency injection on them. In other words: if a controller needs a service "A", then it should get it in the constructor, or through setter/property injection.
</blockquote>
<p>
The <a href="http://www.reddit.com/r/PHP/comments/1caidn/dependency_injection_in_zf2_and_symfony_2_are/">comments</a> talk some about the "controller from the DI container" idea, some other ways around the problem and some clarification as to what the frameworks are actually doing related to the container injection.
</p>
Link: http://www.reddit.com/r/PHP/comments/1caidn/dependency_injection_in_zf2_and_symfony_2_are]]></description>
      <pubDate>Tue, 16 Apr 2013 12:40:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Codeception Blog: The Locator Class]]></title>
      <guid>http://www.phpdeveloper.org/news/18526</guid>
      <link>http://www.phpdeveloper.org/news/18526</link>
      <description><![CDATA[<p>
The Codeception blog (a BDD testing tool) has a new post on <a href="http://codeception.com/09-24-2012/locator.html">using their Locator class</a> to create more complex tests based on XPath or CSS selectors.
</p>
<blockquote>
In the latest Codeception 1.1.4 new Locator class was introduced. Basically it should simplify your life in writing complex XPath or CSS locators. Right now it has minimal, yet useful functionality.
</blockquote>
<p>
The post shows how to combine more than one item for location with either a tag, CSS-based or XPath-based selector. It also shows how to use the "tabindex" method to simulate the movement through a page using the "Tab" key. Finally, there's a quick piece of code showing how to locate an item based on the "href" value. For more information on using Codeception, check out <a href="http://codeception.com/doc">their documentation</a> or the project's <a href="http://codeception.com">main site</a>.
</p>]]></description>
      <pubDate>Thu, 27 Sep 2012 09:50:34 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: An Introduction to Dependency Injection, Service Locators & Factories (Part 1)]]></title>
      <guid>http://www.phpdeveloper.org/news/18120</guid>
      <link>http://www.phpdeveloper.org/news/18120</link>
      <description><![CDATA[<p>
On PHPMaster.com they've posted the <a href="http://phpmaster.com/managing-class-dependencies-1/">first part of a series</a> looking at something that's become a hot topic in the PHP community over the last months - dependency management and service locators.
</p>
<blockquote>
<p>
From a programmer's perspective, the process of designing easily consumable APIs while still keeping a decent level of decoupling between the involved classes is always a tricky trade-off, as the more expressive the dependencies are, the harder the work is that needs to be done behind the scenes for wiring up the collaborators in their proper sequence.
</p>
<p>
 In this two-part series I'll be doing a quick roundup of some of the most common methodologies that can be employed for managing class dependencies in modern application development, ranging from using service locators and injectable factories, to sinking your teeth into plain vanilla Dependency Injection, and even implementing a naive Dependency Injection Container.
</p>
</blockquote>
<p>
He talks about the "plague of the 'new' operators" and how, through the use of an injected factory object, they could be easily replaced. Code samples are included showing the initial state and the end result, refactored to inject his "SerializerFactoryInterface" into the "FileStorage" class.
</p>]]></description>
      <pubDate>Thu, 21 Jun 2012 08:59:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christopher Jones' Blog: Location Awareness With Oracle Spatial in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/9863</guid>
      <link>http://www.phpdeveloper.org/news/9863</link>
      <description><![CDATA[<p>
<i>Christopher Jones</i> has <a href="http://blogs.oracle.com/opal/2008/03/27#a286">posted a script</a> to his blog today giving an example of how you can use the <a href="http://www.oracle.com/technology/products/spatial/index.html">Spatial functionality</a> of Oracle in a PHP application:
</p>
<blockquote>
Oracle Spatial is a powerful library for adding location awareness to applications. This script uses the core subset of Spatial, called Oracle Locator, which is included in all Oracle Database editions.
</blockquote>
<p>
<a href="http://blogs.oracle.com/opal/2008/03/27#a286">His example</a> connects to the database resource and makes a few example SQL queries: one that uses the sod_nn() function built in to the Spatial package to grab the store locations close to the customers, another that finds the latitude and longitude for a customer's information and a method for querying an object collection of locations in a given area.
</p>]]></description>
      <pubDate>Thu, 27 Mar 2008 07:50:11 -0500</pubDate>
    </item>
  </channel>
</rss>
