<?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>Tue, 21 May 2013 01:41:21 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Gonzalo Ayuso: Handling several PDO Database connections in Symfony2 through the DIC in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/19007</guid>
      <link>http://www.phpdeveloper.org/news/19007</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has <a href="http://gonzalo123.com/2013/01/07/handling-several-pdo-database-connections-in-symfony2-through-the-dependency-injection-container-with-php/">written up a new post</a> about a handling method he's worked up for working with multiple PDO instances (database connections) through the Symfony2 dependency injection container using custom YML definitions and a simple "Db" class.
</p>
<blockquote>
I'm not a big fan of ORMs, especially in PHP world when all dies at the end of each request. Plain SQL is easy to understand and very powerful. Anyway in PHP we have Doctrine. Doctrine is a amazing project, probably (with permission of Symfony2) the most advanced PHP project, but I normally prefer to work with SQL instead of Doctrine. [...] Due to my daily work I need to connect to different databases (not only one) in my applications.
</blockquote>
<p>
He shows the normal setup using the "parameters.yml" file to define the multiple database connections but notes that this isn't the most ideal solution. Instead, he walks you through the steps to create the "databases.yml" configuration file and a simple "Db" class that acts as an interface to pull the PDO objects from the container. You can then just call the "get" method on the container to extract the fully configured PDO object, ready for use.
</p>]]></description>
      <pubDate>Tue, 08 Jan 2013 11:52:40 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso: Multiple inheritance with PHP and Traits]]></title>
      <guid>http://www.phpdeveloper.org/news/18919</guid>
      <link>http://www.phpdeveloper.org/news/18919</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post today showing how you can use <a href="http://php.net/traits">traits</a> in PHP to simulate <a href="http://gonzalo123.com/2012/12/17/multiple-inheritance-with-php-and-traits/">a kind of multiple inheritance</a>.
</p>
<blockquote>
Multiple inheritance isn't allowed in PHP. [It's not] possible with PHP (in Java is not possible either), but today we can do something similar (is not the exactly the same) with Traits. Let me explain that: Instead of classes we can create Traits.
</blockquote>
<p>
He includes a code example showing the creation of two traits, "Base1" and "Base2", that are implemented (via "use") and the calls to methods on each. He also points out the error condition and message that can come up when there's a conflict in the method names between two or more traits. This is relatively easy to solve with the mapping ability of the "use" statement (code example included for that too).
</p>]]></description>
      <pubDate>Wed, 19 Dec 2012 13:17:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jachim Coudenys: Using multiple databases in phpunit/dbunit with Composer]]></title>
      <guid>http://www.phpdeveloper.org/news/18783</guid>
      <link>http://www.phpdeveloper.org/news/18783</link>
      <description><![CDATA[<p>
<i>Jachim Coudenys</i> has a new post to his site today showing you how to <a href="http://blog.jachim.be/2012/11/using-multiple-databases-in-phpunitdbunit-with-composer/">use multiple databases with phpunit/dbunit</a> with functionality installed via <a href="http://getcomposer.com">Composer</a>.
</p>
<blockquote>
<a href="http://www.phpunit.de/manual/current/en/database.html">phpunit/dbunit</a> is excellent, but you are stuck with one database. The guys at <a href="http://codeascraft.etsy.com/">Etsy</a> created very <a href="https://github.com/etsy/phpunit-extensions/">good extensions</a> to fix this problem (<a href="https://github.com/etsy/phpunit-extensions/wiki/Multiple-Database">MultipleDatabase</a>), but it took me a while to figure out how to use it. Because PHPUnit is now available <a href="http://www.phpunit.de/manual/current/en/installation.html#installation.composer">via Composer</a>, you can fetch all dependencies with a single command.
</blockquote>
<p>
He includes an example of a "composer.json" configuration file that pulls down tools including PHPUnit, dbunit, the Etsy extensions and Mockery for mock object testing. He suggests making a "parent class" to extend the DatabaseTest class to manage the database connections and includes an example of the code to get the connection and issue the method to check via the <a href="http://www.phpunit.de/manual/current/en/database.html#database-assertions-api">database assertions</a>.
</p>]]></description>
      <pubDate>Wed, 21 Nov 2012 11:56:04 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Changeblog: How to install PHP 5.3 and 5.2 together on Ubuntu 12.04]]></title>
      <guid>http://www.phpdeveloper.org/news/18322</guid>
      <link>http://www.phpdeveloper.org/news/18322</link>
      <description><![CDATA[<p>
On the Changeblog there's a recent post showing you how to get <a href="http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204">both PHP 5.2 and PHP 5.3 installed</a> on the same machine for your development or testing needs (they target it at Durpal users, but it applies for any PHP app).
</p>
<blockquote>
Although Drupals 7+ run smoothly on PHP 5.3, Drupal 6 still feels much better with PHP 5.2. Even though D6 core is compatible with PHP 5.3 for quite some time now, a lot of contributes modules still get nasty hiccup when asked to run on the newer version. Therefore developing for both D7 and D6 at the same time becomes much less painful when running both versions of PHP in parallel.
</blockquote>
<p>
They help you get things compiled from source with the command line input you'll need to get it up and working. Also included is a handy section about possible errors you could get during the configure as well as the packages you might need to install to fix them. Also included are the updates you'll need to make to your configuration files to get things up and running.
</p>]]></description>
      <pubDate>Mon, 06 Aug 2012 11:18:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Joshua Thijssen: @MultiParamConverter for Symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/18319</guid>
      <link>http://www.phpdeveloper.org/news/18319</link>
      <description><![CDATA[<p>
<i>Joshua Thijssen</i> has a recent post to his site about <a href="http://www.adayinthelifeof.nl/2012/08/04/multiparamconverter-for-symfony2/">the MultiParamConverter</a> available for the Symfony 2 framework - a tool he's created to make working with multiple slugs and entities.
</p>
<blockquote>
If you know Symfony2, you probably are using (or at least, have heard of) the <a href="http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html">@paramConverter annotation</a> from the SensioFrameworkExtraBundle. This is a really simple way to convert slugs into entities. But lots of times I find myself having multiple slugs inside my routes, and this is something the @paramConverter annotation cannot do. So that's why I've created the multiParamConverter.
</blockquote>
<p>
To review (or introduce it for those new to it) he talks a bit about the normal "paramConverter" (including a bit of code) and shows how it can replace the fetch of an entity based off a parameter via a DocBlock annotation. Due to the inflexibility of this method, his "MultiParamConverter" lets you define the association for multiple parameters For those that want a peek "under the covers", he includes a section on how it all works and what parts of the framework it uses. 
</p>]]></description>
      <pubDate>Mon, 06 Aug 2012 08:47:14 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Community News: PHP Benchmarks Compared to Several Languages]]></title>
      <guid>http://www.phpdeveloper.org/news/18271</guid>
      <link>http://www.phpdeveloper.org/news/18271</link>
      <description><![CDATA[<p>
<i>Ariz Jacinto</i> has <a href="http://www.mentby.com/ariz-jacinto/see-how-php-outperforms-other-scripting-languages-in-the-latest-computer-language-benchmarks-game.html">pointed out some results</a> from a recent benchmarking "game" that compares the performance of several languages against each other in overall speed.
</p>
<blockquote>
Here's the <a href="http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php?gpp=on&java=on&php=on&python3=on&yarv=on&perl=on&calc=chart">link</a> to the Computer Language Benchmark Game as of July 
15, 2012. You'll see that the median speed of PHP is slightly faster 
than Python 3 and Ruby 1.9 on x64 Ubuntu/IntelQ6600 Quad-core machine.
</blockquote>
<p>
You can <a href="http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php?gpp=on&java=on&php=on&python3=on&yarv=on&perl=on&calc=chart">visit the results page</a> and turn on and off various languages to get the updated results in the chart. You can also limit it down to one of the many benchmarking test types as well.
</p>]]></description>
      <pubDate>Wed, 25 Jul 2012 09:14:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Refulz.com: Traits in PHP - Multiple and Nested Traits]]></title>
      <guid>http://www.phpdeveloper.org/news/18009</guid>
      <link>http://www.phpdeveloper.org/news/18009</link>
      <description><![CDATA[<p>
On the Refulz.com blog there's a new tutorial posted looking at <a href="http://php.refulz.com/traits-in-php-multiple-and-nested-traits/">traits (and nested traits) in PHP</a> including examples of them in use and how to create your own.
</p>
<blockquote>
Traits is a good new addition to PHP language. In our series about the <a href="http://php.refulz.com/series/new-in-php-5-4/">new features of PHP 5.4</a>, we reviewed the concept of Traits in PHP. The <a href="http://php.refulz.com/traits-in-php-5-4-introduction/">introductory article</a> talks about what the traits are and what is the general syntax of Traits in PHP. The second article attempts to explain <a href="http://php.refulz.com/traits-in-php-5-4-why-we-need-traits/">why we need traits</a>.
</blockquote>
<p>
The tutorial shows you how to define a custom trait use things like abstract methods, nesting them by making them "users" and how to use multiples at the same time (comma-separating).
</p>]]></description>
      <pubDate>Mon, 28 May 2012 15:16:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Kevin Schroeder's Blog: ZF2 Dependency Injection - Multiple Object Instances]]></title>
      <guid>http://www.phpdeveloper.org/news/17884</guid>
      <link>http://www.phpdeveloper.org/news/17884</link>
      <description><![CDATA[<p>
<i>Kevin Schroeder</i> has <a href="http://www.eschrade.com/page/zf2-dependency-injection-multiple-object-instances">a quick new post</a> about using dependency injection in Zend Framework 2 applications using multiple object instances.
</p>
<blockquote>
When you work with the ZF2 Dependency Injection Container (DiC) when you make multiple requests for an instance of an object you will get the same object back each time. [...] But what if you want the injection benefits of the DiC but don't want to share the object?  Use the DiC's newInstance method instead with the third parameter being false.
</blockquote>
<p>
He includes code examples of requesting the object both ways - the usual way that returns the same object and the alternative that passes in a "false" value, complete with a <a href="http://php.net/var_dump">debug output</a> of each object proving they're different.
</p>]]></description>
      <pubDate>Mon, 30 Apr 2012 12:15:34 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Hakre's Blog: Iterating over Multiple Iterators at Once]]></title>
      <guid>http://www.phpdeveloper.org/news/17822</guid>
      <link>http://www.phpdeveloper.org/news/17822</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Hakre</i> looks at <a href="http://hakre.wordpress.com/2012/04/05/iterating-over-multiple-iterators-at-once/">iterating over iterators</a> (multiples all at once) using either the Append Iterator or the MultipleIterator.
</p>
<blockquote>
PHP's SPL has two build-in Iterators that deal with multiple iterators at once: <a href="http://php.net/manual/en/class.appenditerator.php">AppendIterator</a> and <a href="http://php.net/manual/en/class.multipleiterator.php">MultipleIterator</a>. In this posting I'll cover both a bit.
</blockquote>
<p>
He gives some sample code for each - showing how to use the AppendIterator to combine multiple iterators into one set and using the MultipleIterator to attach (not append/merge into one set) multiple iterator objects to a single, iteratable object. He als mentions a "lost" iterator, the <a href="http://code.google.com/p/cvphplib/source/browse/trunk/cvphplib/code/DualIterator.php?r=6">DualIterator</a> that never made it out of a SVN repository and into the main codebase.
</p>]]></description>
      <pubDate>Mon, 16 Apr 2012 12:09:44 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Liip Blog: Table Inheritance with Doctrine]]></title>
      <guid>http://www.phpdeveloper.org/news/17742</guid>
      <link>http://www.phpdeveloper.org/news/17742</link>
      <description><![CDATA[<p>
On the Liip blog there's a recent post looking at <a href="http://blog.liip.ch/archive/2012/03/27/table-inheritance-with-doctrine.html">table inheritance with Doctrine</a>, the popular <a href="http://www.doctrine-project.org/">PHP ORM tool</a>. In the post, <i>Daniel Barsotti</i> talks about a database model that needed some updating due to their searching needs.
</p>
<blockquote>
Our first idea, and it was not that bad, Drupal does just the same, was to have a database table with the common fields, a field containing the type of item (it's either an event or a blog post) and a data field where we serialized the corresponding PHP object. This approach was ok until we had to filter or search LabLog items based on fields that were contained in the serialized data.
</blockquote>
<p>
To resolve the issue they turned to multiple table inheritance, relating the LabLogItem to both a BlogPost and Event. They also show how it could be modeled with a single table, but opt for the multiple method. Included in the post is the Doctrine-based code showing how to create the parent entity for the LabLogItem and the two child entities for the blog post and event. There's also a brief snippet showing how to use them with the EntityManager. 
</p>]]></description>
      <pubDate>Wed, 28 Mar 2012 09:30:09 -0500</pubDate>
    </item>
  </channel>
</rss>
