<?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>Wed, 19 Jun 2013 09:09:38 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Stefan Koopmanschap: Data migration with Doctrine2]]></title>
      <guid>http://www.phpdeveloper.org/news/18269</guid>
      <link>http://www.phpdeveloper.org/news/18269</link>
      <description><![CDATA[<p>
In <a href="http://www.leftontheweb.com/message/Data_migration_with_Doctrine2">this latest post</a> to his site <i>Stefan Koopmanschap</i> shares a solution he's found to migrating data with Doctrine2 from an existing structure.
</p>
<blockquote>
A project that I'm working on right now required me to migrate data from the existing database to the new database and database structure. Since the application is built on top of Symfony2, I decided to write a <a href="http://symfony.com/doc/current/cookbook/console/console_command.html">Command</a> that would take care of the migration. I ran into an issue though: Doctrine2 insisted on creating new IDs where I wanted to keep the old one. The solution turned out to be really simple.
</blockquote>
<p>
The actual code for the Command is only a few lines long - it just turns off the "AUTO" strategy for each of your entities, making it ignore any IDs you have set on the entity already.
</p>]]></description>
      <pubDate>Wed, 25 Jul 2012 08:18:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Martin Sikora's Blog: Silex + Doctrine 2 ORM]]></title>
      <guid>http://www.phpdeveloper.org/news/17924</guid>
      <link>http://www.phpdeveloper.org/news/17924</link>
      <description><![CDATA[<p>
<i>Martin Sikora</i> has shared some of his experience with setting up a Silex instance to <a href="http://martinsikora.com/silex-doctrine2-orm">work with Doctrine2</a> in a new post to his blog. The popular microframework comes with a built-in Doctrine service provider, so integration isn't overly difficult.
</p>
<blockquote>
<a href="http://silex.sensiolabs.org/">Silex</a> is great for its simplicity, however for larger projects you probably want to use some ORM like <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html">Doctrine</a> but there's <a href="http://silex.sensiolabs.org/doc/providers/doctrine.html">build-in service provider only for Doctrine DBAL</a> and not ORM.
</blockquote>
<p>He breaks it up into five smaller steps, each with code samples to help clarify:</p>
<ul>
<li>Doctrine 2 ORM Service Provider
<li>Create your entity classes
<li>Mind Doctrine DBAL and Doctrine ORM versions
<li>Doctrine CLI
<li>Working with Doctrine ORM
</ul>]]></description>
      <pubDate>Tue, 08 May 2012 11:12:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Evan Coury's Blog: Sharing a database connection across modules in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/17876</guid>
      <link>http://www.phpdeveloper.org/news/17876</link>
      <description><![CDATA[<p>
<i>Evan Coury</i> has a new post to his site about a handy method for <a href="http://blog.evan.pro/sharing-a-database-connection-across-modules-in-zend-framework-2">sharing database connections across modules</a> in a Zend Framework application.
</p>
<blockquote>
With the new modular infrastructure in Zend Framework 2, one of the most common questions will indoubitably be how to share a database connection across modules. Here's a quick explanation of how to share your database connection across multiple modules in a way that can even allow you to use a single connection between ZendDb, Doctrine2, and possibly even other database libraries / ORMs.
</blockquote>
<p>
He includes the code in the post to configure this application-wide database resource, a "masterdb_pdo" that uses a MySQL backend. This configuration is used to set up the connection in a dependency injection container for later (globalish) use. He also mentions something similar about sharing Doctrine connections with the ZendDb components (using the same DI container approach).
</p>]]></description>
      <pubDate>Fri, 27 Apr 2012 09:54:56 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jason Grimes' Blog: Using Doctrine 2 in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/17463</guid>
      <link>http://www.phpdeveloper.org/news/17463</link>
      <description><![CDATA[<p>
<i>Jason Grimes</i> has posted a new tutorial to his blog about <a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/">integrating Zend Framework 2 with Doctrine</a>, the powerful (and popular) ORM tool for PHP. In his example, he shows how to use them to store the album information from Rob's tutorial.
</p>
<blockquote>
Zend Framework 2 is getting close to release, and among the changes are new ways to handle dependency injection, and new ways to work with third-party code as modules. Rob "Akrabat" Allen has updated his iconic <a href="http://akrabat.com/getting-started-with-zend-framework-2/">Getting Started with Zend Framework</a> tutorial for ZF2, and it's a great place to start. After working through that tutorial, the next thing I wanted to do was figure out how to get the Doctrine 2 ORM up and running. This article shows how to set up and use Doctrine 2 in Zend Framework 2, by extending Rob's Getting Started tutorial to use Doctrine instead of Zend_Db.
</blockquote>
<p>
Using <a href="http://akrabat.com/getting-started-with-zend-framework-2/">Rob's example</a> as a starting point, he shows how to install the Doctrine modules, update the "Album" model and controller to use Doctrine instead of Zend_Db and create the entity for the Albums.
</p>]]></description>
      <pubDate>Mon, 30 Jan 2012 10:02:36 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Henrik Bj&oslashrnskov's Blog: Symfony2: How to do a Wizard (multistep form) with Doctrine2]]></title>
      <guid>http://www.phpdeveloper.org/news/17080</guid>
      <link>http://www.phpdeveloper.org/news/17080</link>
      <description><![CDATA[<p>
<i>Henrik Bj&oslashrnskov</i> has a new post with a technique you can use to combine Symfony2 and Doctrine2 to create a <a href="http://henrik.bjrnskov.dk/symfony2-wizard-doctrine/">multi-step form</a> (a wizard) without having to worry about lost user information between steps.
</p>
<blockquote>
The easy ways is doing it with Javascript and just show/hide the correct fieldsets when needed. The downside with this approach is that the data is only saved and validated once at the end. So if the user reloads the page the entered information is gone. The other way is to have every Step in the Wizard being a seperate form and validate the data based on what step you are on and save the necessary fields.
</blockquote>
<p>
For his method, he created a Manager class with a StepInterface that returns the correct field names, forms and template information to render. The interface code is included in the post as well as an example of it in use setting up the wizard object, making a report and getting the correct step information from the wizard.
</p>]]></description>
      <pubDate>Thu, 03 Nov 2011 09:13:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Phar: PHP libraries included with a single file]]></title>
      <guid>http://www.phpdeveloper.org/news/16900</guid>
      <link>http://www.phpdeveloper.org/news/16900</link>
      <description><![CDATA[<p>
On DZone.com today <i>Giorgio Sironi</i> has a new post looking at an interesting, if seldom used, feature of recent PHP releases - <a href="http://css.dzone.com/articles/phar-php-libraries-single-file">packaging applications with phar archives</a>.
</p>
<blockquote>
<a href="http://php.net/phar">Phar</a> is a php extensions that provides the means for distributing code as a single archive, that does not have to be extracted to a folder before usage. The concept is similar to JVM Jars: each archive becomes a virtual directory where files can be accessed. However, the virtual folder is not limited to class loading, but you can open and read internal files as if it were decompresse into a directory.
</blockquote>
<p>
He includes a brief "hello world" example of packaging up a script into a phar archive and executing it via PHP. He also shows how easy it is to create an archive from current code, making an archive containing the latest Doctrine 2 release for simple inclusion. Phars also allow compression and hashing but has issues with resource management and access external files.
</p>]]></description>
      <pubDate>Fri, 23 Sep 2011 11:30:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: PHPUnit Fundamentals: Setting Up and Tearing Down a Doctrine 2 Database]]></title>
      <guid>http://www.phpdeveloper.org/news/16736</guid>
      <link>http://www.phpdeveloper.org/news/16736</link>
      <description><![CDATA[<p>
New on PHPBuilder.com today is a tutorial showing you how to use set up and tear down methods in <a href="http://phpunit.de">PHPUnit</a> unit tests to <a href="http://www.phpbuilder.com/columns/phpunit-doctrine/Jason_Gilmore08172011.php3">work with a Doctrine 2 database</a>, making it simpler to run self-contained testing.
</p>
<blockquote>
The recently released Doctrine 2 presents significant advantages over its 1.X predecessor, advantages which are even more pronounced when compared to the Zend Framework's default database solution, namely the <a href="http://framework.zend.com/manual/en/zend.db.html">Zend_Db component</a>. [...] When running unit tests which vet various aspects of your database you'll want to setup (create) and teardown (destroy) the test database, ensuring that a pristine and repeatable version of the database is available to each test. 
</blockquote>
<p>
He includes an example of using the SchemaTool class (of Doctrine) to drop and recreate the schema from scratch with the end result of a clean working copy, ready to test from. He also includes an example of how to initialize the database with some default information using the PHPUnit database connection and a default set of fixtures (defined in YAML).
</p>]]></description>
      <pubDate>Thu, 18 Aug 2011 09:03:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Database Abstraction Layers in PHP. PDO versus DBAL]]></title>
      <guid>http://www.phpdeveloper.org/news/16579</guid>
      <link>http://www.phpdeveloper.org/news/16579</link>
      <description><![CDATA[<p>
In <a href="http://gonzalo123.wordpress.com/2011/07/11/database-abstraction-layers-in-php-pdo-versus-dbal/">this new post</a> to his blog, <i>Gonzalo Ayuso</i> compares two technologies that can make working with databases in your applications simpler - <a href="http://php.net/manual/en/book.pdo.php">PDO</a> and the Doctrine2 <a href="http://www.doctrine-project.org/projects/dbal/2.0/docs/en">DBAL</a> layer.
</p>
<blockquote>
In fact DBAL isn't a pure database abstraction layer. It's built over PDO. It's a set of PHP classes we can use that gives us features not available with 'pure' PDO. If we use Doctrine2 we're using DBAL behind the scene, but we don't need to use Doctrine2 to use DBAL. We can use DBAL as a database abstraction layer without any ORM. Obiously this extra PHP layer over our PDO extension needs to pay a fee. I will have a look to this fee in this post.
</blockquote>
<p>
He includes a few simple benchmarking scripts that compare similar operations done by either, including memory usage and execution time. PDO comes out on top, obviously, because it's an extension versus a set of PHP libraries that need to be included in the application. He does include examples of a few things he likes that DBAL does that PDO doesn't by default - a transactional mode, type conversion, a simpler binding interface and the ability to nest transactions.
</p>]]></description>
      <pubDate>Tue, 12 Jul 2011 10:14:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Tibo Beijen's Blog: DDD using Doctrine 2: A case study]]></title>
      <guid>http://www.phpdeveloper.org/news/16528</guid>
      <link>http://www.phpdeveloper.org/news/16528</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Tibo Beijen</i> <a href="http://www.tibobeijen.nl/blog/2011/06/27/ddd-using-doctrine-2-a-case-study/">presents a case study</a> about doing Domain Driven Design in an application using <a href="http://www.doctrine-project.org/projects/orm/2.0/docs/en">Doctrine2</a> to work with objects and your database.
</p>
<blockquote>
Nowadays developing web applications usually requires a flexible process due to changing business logic, shifting priorities or new insights. Besides choosing the right methodology this also requires designing the application in such a way that this flexibility can be achieved. [...] In this article I will show how to implement a specific case using Doctrine 2. Full code accompanying this article can be <a href="https://github.com/TBeijen/DDD-HRM/tree/v001">found on GitHub</a>. 
</blockquote>
<p>
He starts by describing the entities (User/TimeSheet/TimeSheetStatusChange) and how they're defined in Doctrine objects. He modifies them to build in some business-level restrictions like "status changes are only allowed in a certain order". He shows that the domain models presented are about more than just working with the database tables. They enforce rules that effect the flow of the application as well.
</p>]]></description>
      <pubDate>Tue, 28 Jun 2011 10:54:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Wojciech Sznapka's Blog: Fully isolated tests in Symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/16473</guid>
      <link>http://www.phpdeveloper.org/news/16473</link>
      <description><![CDATA[<p>
<i>Wojciech Sznapka</i> has a new post to his blog today looking at his creation of <a href="http://blog.sznapka.pl/fully-isolated-tests-in-symfony2/">fully isolated tests</a> as a part of a Symfony2 application. He talks about two issues he recently solved with testing services in this popular framework.
</p>
<blockquote>
The most important thing you should provide with your re-usable bundles is unit tests set. Lately I solved two major cases which Symfony2 hasn't got out of the box: testing services, defined in Dependency Injection Container and running model tests with fixtures in fully isolated environment.
</blockquote>
<p>
He includes code snippets for both solutions - a BaseTestClass for working with dependency injection testing and a ModelTestCase class that, in the setUp(), loads in the required fixtures so the test can be completely isolated.
</p>]]></description>
      <pubDate>Wed, 15 Jun 2011 11:18:49 -0500</pubDate>
    </item>
  </channel>
</rss>
