<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brandon&#039;s Blog &#187; symfony</title>
	<atom:link href="http://www.brandonturner.net/blog/tag/symfony/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brandonturner.net/blog</link>
	<description>Random thoughts on web applications, software development and Linux</description>
	<lastBuildDate>Thu, 08 Apr 2010 01:47:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using Doctrine 1.1 with Symfony 1.2</title>
		<link>http://www.brandonturner.net/blog/2009/05/doctrine11-with-symfony12/</link>
		<comments>http://www.brandonturner.net/blog/2009/05/doctrine11-with-symfony12/#comments</comments>
		<pubDate>Tue, 05 May 2009 01:05:40 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
				<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.brandonturner.net/blog/?p=270</guid>
		<description><![CDATA[Doctrine 1.1 doesn't come with Symfony 1.2, however it was recently released stable.  This describes how to use Doctrine 1.1 with Symfony 1.2 including patches.]]></description>
			<content:encoded><![CDATA[<p>I recently started a new project using the <a href="http://www.symfony-project.org">Symfony PHP Framework</a>.  I&#8217;ve used Symfony before and love it.  In the past I&#8217;ve used Propel, but as Symfony now fully supports <a href="http://www.doctrine-project.org">Doctrine</a> and Doctrine looks very promising, I decided to give it a shot for my latest project.</p>
<p>Symfony 1.2 currently uses Doctrine 1.0.  Doctrine 1.1 was <a href="http://www.doctrine-project.org/blog/doctrine-1-1-released">released</a> in March.  Symfony 1.3 will support Doctrine 1.1, but won&#8217;t be released until <a href="http://www.symfony-project.org/blog/2009/01/25/about-symfony-1-3">November</a>.</p>
<p>Since I&#8217;m starting a new project, I wanted to try to use the latest version of Doctrine.  I&#8217;ll be honest, I don&#8217;t have a great reason for doing this other then the pain I went through migrating an old project (with lots of custom model stuff) from Propel 1.2 to Propel 1.3.  I understand this is an apples to oranges comparison, however its the only motivation I&#8217;ve got.  Feel free to stop reading now.</p>
<p>Overall the Symfony developers have made it extremely easy to use Doctrine 1.1 with Symfony 1.2.  However, given this is an <strong>unsupported</strong> configuration, they don&#8217;t back-port any patches related to Doctrine 1.1 from the Symfony 1.3 branch to sf 1.2.  In this post I will try to catalog the changes and provide a back-port patch you can use to integrate Doctrine 1.1 into your sf 1.2 projects.</p>
<h4>Related Postings</h4>
<p>Here are some pages/tickets/changesets related to Doctrine 1.1 with Symfony.  If I&#8217;m missing something, please leave me a comment below and I&#8217;ll update this ASAP!</p>
<table>
<tr class="first">
<td><a href="http://www.symfony-project.org/blog/2009/01/12/call-the-expert-using-a-custom-version-of-doctrine">Symfony Blog</a></td>
<td>Call the expert: Using a custom version of Doctrine</td>
</tr>
<tr>
<td><a href="http://trac.symfony-project.org/ticket/5667">Ticket 5667</a></td>
<td>In generated forms, Doctrine 1.1 does not save model after linking relations.</td>
</tr>
<tr>
<td><a href="http://trac.symfony-project.org/ticket/5741">Ticket 5741</a></td>
<td>CLI doesn&#8217;t use the right installation of Doctrine</td>
</tr>
<tr>
<td><a href="http://trac.symfony-project.org/ticket/6285">Ticket 6285</a></td>
<td>Form generator, saving linked objects problem (SF 1.2 + Doctrine 1.1)</td>
</tr>
<tr>
<td><a href="http://trac.symfony-project.org/changeset/16508">Changeset 16508</a></td>
<td>fix for admin gen and Doctrine 1.1 link()/unlink() methods (fixes <a href="http://trac.symfony-project.org/ticket/5667">#5667</a>, <a href="http://trac.symfony-project.org/ticket/6285">#6285</a>)</td>
</tr>
<tr>
<td><a href="http://trac.symfony-project.org/ticket/6373">Ticket 6373</a></td>
<td>sfDoctrineGuardPlugin support Doctrine 1.1</td>
</tr>
</table>
<h4>Installing Doctrine 1.1</h4>
<p>To get started using Doctrine 1.1, you&#8217;ll need to download it.  Jonathan Wage provided instructions <a href="http://www.symfony-project.org/blog/2009/01/12/call-the-expert-using-a-custom-version-of-doctrine">here</a> which I&#8217;ll reproduce below.</p>
<p>From your Symfony project&#8217;s root folder:</p>
<div class="prompt">
$ <span class="cmd">cd lib/vendor</span><br />
$ <span class="cmd">svn co http://svn.doctrine-project.org/branches/1.1/lib doctrine</span>
</div>
<p>Now change the location of the Doctrine lib path by editing your <code>ProjectConfiguration::setup()</code> method to look similar to:</p>
<pre class="brush: php;">
public function setup()
{
  sfConfig::set('sfDoctrinePlugin_doctrine_lib_path', sfConfig::get('sf_lib_dir') . '/vendor/doctrine/Doctrine.php');
}
</pre>
<h4>Patch Symfony Library</h4>
<p>Now you need to patch the Symfony library with the back-ported changes related to Doctrine from the Symfony 1.3 branch.  This patch is very simple, and currently only effects one file.</p>
<p>Navigate to your Symfony lib directory.  Depending on how you started your project, this is probably the <code>lib/symfony</code> directory in your project.</p>
<div class="prompt">
$ <span class="cmd">wget <a href="http://www.bltweb.net/patches/symfony-1.2.7-doctrine-1.1.patch">http://www.bltweb.net/patches/symfony-1.2.7-doctrine-1.1.patch</a></span><br />
$ <span class="cmd">patch -p0 &lt; symfony-1.2.7-doctrine-1.1.patch</span>
</div>
<p>Now rebuild your model forms.  From your project&#8217;s root directory:</p>
<div class="prompt">
$ <span class="cmd">php symfony doctrine:build-forms</span><br />
$ <span class="cmd">php symfony cc</span>
</div>
<h4>Patch sfDoctrineGuardPlugin</h4>
<p>If you use the <code>sfDoctrineGuardPlugin</code> you will need to apply another patch.</p>
<p>From your project&#8217;s root directory:</p>
<div class="prompt">
$ <span class="cmd">wget <a href="http://www.bltweb.net/patches/sfDoctrineGuardPlugin-doctrine-1.1.patch">http://www.bltweb.net/patches/sfDoctrineGuardPlugin-doctrine-1.1.patch</a></span><br />
$ <span class="cmd">patch -p0 &lt; sfDoctrineGuardPlugin-doctrine-1.1.patch</span>
</div>
<h4>Finished!</h4>
<p>You should now be able to use Doctrine 1.1 with Symfony 1.2.  I haven&#8217;t run into any problems using it, however I&#8217;ve just gotten started with my new project and haven&#8217;t done much of anything yet!  If you have troubles let me know.</p>
<p>For anyone on Gentoo, I have a <a href="http://svn.bltweb.net/repos/public/gentoo_overlay/dev-php5/symfony/symfony-1.2.7-r2.ebuild">symfony ebuild</a> in my <a href="/blog/gentoo-overlay/">Gentoo Overlay</a> that will install Symfony 1.2 with Doctrine 1.1 support for you.</p>
<p>I&#8217;ll try to keep this post updated if I come across anything else that needs to change when using Doctrine 1.1 with Symfony 1.2.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brandonturner.net/blog/2009/05/doctrine11-with-symfony12/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
