<?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>Eat my monkeydust &#187; PHP</title>
	<atom:link href="http://eatmymonkeydust.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://eatmymonkeydust.com</link>
	<description>Life, PHP and Symfony - straight from the monkey's mouth</description>
	<lastBuildDate>Fri, 07 Oct 2011 14:00:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Redpill Linpro and Varnish software, Gold sponsors of Symfony Live (Paris) 2011</title>
		<link>http://eatmymonkeydust.com/2011/01/redpill-linpro-and-varnish-software-gold-sponsors-of-symfony-live-paris-2011/</link>
		<comments>http://eatmymonkeydust.com/2011/01/redpill-linpro-and-varnish-software-gold-sponsors-of-symfony-live-paris-2011/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 11:26:18 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=284</guid>
		<description><![CDATA[Introduction As a Symfony user and contributor for several years, it gives me great pleasure to announce that the company I work for Redpill Linpro along with sister company Varnish Software have agreed to be gold sponsors of the Symfony Live conference in Paris (March 2011). As a company we have benefited from the Symfony [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://eatmymonkeydust.com/wp-content/uploads/2011/01/redpill_linpro_varnish.png"><img class="size-full wp-image-285 alignright" style="border: 0pt none;" title="redpill_linpro_varnish" src="http://eatmymonkeydust.com/wp-content/uploads/2011/01/redpill_linpro_varnish.png" alt="" width="231" height="153" /></a></p>
<h2>Introduction</h2>
<p>As a Symfony user and contributor for several years, it gives me great pleasure to announce that the company I work for <a href="http://redpill-linpro.com" target="_blank">Redpill Linpro</a> along with sister company <a href="http://varnish-software.com" target="_blank">Varnish Software</a> have agreed to <strong><span style="color: #ff6600;">be gold sponsors</span></strong> of the <a href="http://www.symfony-live.com/paris" target="_blank">Symfony Live conference in Paris</a> (March 2011).</p>
<p>As a company we have benefited from the Symfony framework in many ways including:</p>
<ul>
<li>Rapid development</li>
<li>Consistency (easy to bring team members in and out)</li>
<li>Community support</li>
<li>Great documentation</li>
</ul>
<p>And given back by providing time for our developers to:</p>
<ul>
<li>File bug reports</li>
<li>Submit patches</li>
<li>Develop plugins</li>
<li>Help other users (particularly in IRC and the Symfony Forum)</li>
<li>Update the documentation</li>
</ul>
<p>By agreeing to <strong><span style="color: #ff6600;">gold sponsorship</span></strong> we are now also making a small financial contribution to the project, whilst at the same time giving ourselves a chance to become more known in the Symfony world, especially with <a href="http://symfony-reloaded.org/" target="_blank">Symfony2</a> just around the corner and its great support for Varnish!</p>
<h2>Brief history of the companies</h2>
<p>Until recently, Redpill and Linpro were two separate companies, and the work done by Varnish Software was a part of Linpro. In 2008, Linpro and Redpill merged to form Redpill Linpro, and in 2010 Varnish Software broke away to form a &#8220;daughter&#8221; company and concentrate on the Varnish cache. Confused?</p>
<p>The most important thing is that all of the companies involved are dedicated to open source, you can read more about <a href="http://redpill-linpro.com/About-us" target="_blank">Redpill Linpro</a> and <a href="http://www.varnish-software.com/about" target="_blank">Varnish Software</a> on their respective web sites.</p>
<h2>Employment Opportunities for Symfony developers in &#8220;the North&#8221;</h2>
<p>If you are looking for a company to work for with a strong PHP team, and either already live in or are considering a move to &#8220;the Nordic region¹&#8221; please get in touch. We also have opportunities for Java developers and <a href="http://redpill-linpro.com/Grow-with-us/Who-are-we-looking-for" target="_blank">various other posts</a> related to Open Source technologies, and if we don&#8217;t have a specific post for you but you are a skilled open source enthusiast, we are also interested in your CV &#8211; who knows, we might be able to create one for you.</p>
<p>¹We have offices in Norway, Sweden, Denmark and Finland, the bulk of Symfony operations are presently in Oslo.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2011/01/redpill-linpro-and-varnish-software-gold-sponsors-of-symfony-live-paris-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redpill Linpro to host &#8220;State of Symfony 2&#8243; conference hub in Oslo</title>
		<link>http://eatmymonkeydust.com/2010/06/redpill-linpro-to-host-symfony-2-conference-hub-in-oslo/</link>
		<comments>http://eatmymonkeydust.com/2010/06/redpill-linpro-to-host-symfony-2-conference-hub-in-oslo/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 08:55:41 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[hub]]></category>
		<category><![CDATA[oslo]]></category>
		<category><![CDATA[redpill linpro]]></category>
		<category><![CDATA[symfony 2]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=273</guid>
		<description><![CDATA[Conference hubs are a way for like minded people to get together and watch/discuss an online conference. One such hub will be hosted in Oslo, Norway by Redpill Linpro (the company I work for). Read Fabien&#8217;s blog bost about conference hubs here. We will be streaming the 10:00 conference on the 22nd June 2010. Refreshments [...]]]></description>
			<content:encoded><![CDATA[<p>Conference hubs are a way for like minded people to get together and watch/discuss an online conference. One such hub will be hosted in Oslo, Norway by <a href="http://www.redpill-linpro.com">Redpill Linpro</a> (the company I work for). <a href="http://www.symfony-project.org/blog/2010/06/09/state-of-symfony-2-conference-hubs" target="_blank">Read Fabien&#8217;s blog bost about conference hubs here</a>.</p>
<p>We will be streaming the 10:00 conference on the 22nd June 2010. Refreshments will be served, please give me a shout if you are interested in coming along so we can buy enough conference tickets (we may be less than 5 people otherwise) and arrange a good sized conference room.</p>
<p>Hope to see you there!</p>
<p>Russ.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2010/06/redpill-linpro-to-host-symfony-2-conference-hub-in-oslo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Doctrine 2 with symfony 1.x [Part 1]</title>
		<link>http://eatmymonkeydust.com/2010/03/using-doctrine-2-with-symfony-1-x-part1/</link>
		<comments>http://eatmymonkeydust.com/2010/03/using-doctrine-2-with-symfony-1-x-part1/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 23:13:13 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[sfDoctrine2plugin]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=256</guid>
		<description><![CDATA[Background It&#8217;s been a while since Jonathan announced the availability of Doctrine 2 for Symfony 1.x (wouldn&#8217;t recommend trying it with anything less than 1.3) and a a few things have changed since then, so here&#8217;s a refresher. We are at a crossroads now with Symfony 2 looming on the horizon, and many developers may [...]]]></description>
			<content:encoded><![CDATA[<h2>Background</h2>
<p>It&#8217;s been a while since <a href="http://www.jwage.com/" target="_blank">Jonathan</a> announced the availability of <a href="http://www.symfony-project.org/blog/2009/10/05/symfony-and-doctrine-2" target="_blank">Doctrine 2 for Symfony 1.x</a> (wouldn&#8217;t recommend trying it with anything less than 1.3) and a a few things have changed since then, so here&#8217;s a refresher.</p>
<p>We are at a crossroads now with Symfony 2 looming on the horizon, and many developers may wish to wait until that is more stable (later this year) to make the move to Symfony 2 and Doctrine 2 simultaneously. This is not such a bad idea, however Doctrine 2 is already at a level where you may wish to consider using it in your projects, you won&#8217;t be disappointed if you do!</p>
<p>It will take me a while to explain why Doctrine 2 is better than Doctrine 1, and more importantly why you should start using &#8211; but you can just take my word for it and take a look at a couple of <a href="http://www.slideshare.net/search/slideshow?searchfrom=header&amp;q=doctrine+2" target="_blank">Jonathan&#8217;s presentations</a> to back up my claim. (I Recommend <a href="http://www.slideshare.net/jwage/doctrine-2-not-the-same-old-php-orm" target="_blank">Doctrine 2 &#8211; not the same old PHP ORM</a>)</p>
<h2>Getting started</h2>
<p>Check out the plugin and set up the database as described in <a href="http://www.symfony-project.org/blog/2009/10/05/symfony-and-doctrine-2">Jon&#8217;s blog</a>, but don&#8217;t configure the schema just yet <img src='http://eatmymonkeydust.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>We&#8217;re going to go all out with the &#8220;Doctrine 2&#8243; way of doing things, so we&#8217;ll be using annotations, not yaml or xml &#8211; although you can look up that syntax if you prefer. (A lot of the stuff below won&#8217;t work though &#8211; you can&#8217;t have multiple yaml files for example yet).</p>
<p>In your project configuration class, you will have access to some methods:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configureDoctrineConnection<span style="color: #009900;">&#40;</span>\Doctrine\ORM\Configuration <span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configureEntityManager<span style="color: #009900;">&#40;</span>\Doctrine\ORM\EntityManager <span style="color: #000088;">$em</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the first of these, you need to add all the things to configure Doctrine before the entity manager can be created. Once Doctrine has created the entity manager, you can use the second method if you need to, to further configure the entity manager. (Registering a Doctrine listener for example).</p>
<p>So, in your configureDoctrineConnection() method, you&#8217;ll want to do something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Decide where you want the proxy classes to be stored, and which namespace they should use</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyDir</span><span style="color: #009900;">&#40;</span>sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sf_cache_dir&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/Proxies&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Proxies&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// You may want to make this environment specific for performance reasons</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAutoGenerateProxyClasses</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSqlLogger</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This will get things working, but later you will want to use APC</span>
<span style="color: #666666; font-style: italic;">// or another &quot;real&quot; cache for production</span>
<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\Cache\ArrayCache<span style="color: #339933;">;</span>
<span style="color: #000088;">$reader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\Annotations\AnnotationReader<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMetadataCacheImpl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQueryCacheImpl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Tell Doctrine where to find your entities (you may have more than one location)</span>
<span style="color: #666666; font-style: italic;">// This is mostly required for cli tasks that iterate over all of your entities</span>
<span style="color: #000088;">$paths</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sf_lib_dir&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/Entities&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Populate this with all the locations of your entities</span>
<span style="color: #000088;">$reader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDefaultAnnotationNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine\ORM\Mapping\\'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$annotation</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Mapping\Driver\AnnotationDriver<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reader</span><span style="color: #339933;">,</span> <span style="color: #000088;">$paths</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMetadataDriverImpl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$annotation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Register all the classes that Doctrine needs to autoload</span>
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Entities\doctrine'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setIncludePath</span><span style="color: #009900;">&#40;</span>sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sf_lib_dir'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Proxies&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setIncludePath</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cachedir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Another<span style="color: #000099; font-weight: bold;">\N</span>amespace&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setIncludePath</span><span style="color: #009900;">&#40;</span>sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sf_lib_dir'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Ok, that was a lot of stuff &#8211; but Doctrine 2 is more verbose &#8211; meaning less magic, but more explicit code. Some of the above calls may not be necessary &#8211; I need to do further testing, and also I&#8217;d like to get a lot of these things &#8220;standardised&#8221; in the plugin, so you can skip a lot of this if you follow a &#8220;default&#8221; path. The problem with the original release of the plugin was that it was not possible to have multiple class dirs, which makes it impossible to have plugins (for example) that also contain Entities. With the approach above, you explicitly add as many classes as you like to the annotation driver and the autoloader, and your plugin configuration classes can do the same.</p>
<h2>Active Entity</h2>
<p>The plugin comes bundled with Active Entity &#8211; this means that by extending ActiveEntity from our model classes (Entities) we can use our classes in much the same way as in Doctrine 1. Things like the following become available:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">toArray</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
\Entities\User<span style="color: #339933;">::</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$user</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>ActiveEntity was written and included with good intentions, because for Doctrine 2 to continue to be compatible with symony in the same way as Doctrine 1, a bit of magic needed to be re-introduced. <strong>BUT</strong> &#8211; for anyone that has been excited by Doctrine 2, one of the major breakthroughs is the non-intrusive model, and ActiveEntity kills that (along with a kitten):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//With ActiveEntity:</span>
<span style="color: #000000; font-weight: bold;">class</span> \Entities\User <span style="color: #000000; font-weight: bold;">extends</span>  \DoctrineExtensions\ActiveEntity <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Without ActiveEntity:</span>
<span style="color: #000000; font-weight: bold;">class</span> \Entities\User extends<span style="color: #339933;">-</span>or<span style="color: #339933;">-</span>does<span style="color: #339933;">-</span>not<span style="color: #339933;">-</span>extend  \Whatever\The\Hell\You\Like <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>So I strongly recommend that you <strong>Don&#8217;t</strong> extend ActiveEntity &#8211; and gradually the plugin will be &#8220;fixed&#8221; so that is never necessary. Currently basic object forms and some widgets are working fine without it, but I haven&#8217;t tested it with admin generators or anything like that yet so feedback is appreciated.</p>
<p>If you follow my advice, you have to do everything the &#8220;Doctrine 2 way&#8221;. That means taking control of your own code! Write your own getters and setters, extend your own classes (if you want to) &#8211; be verbose, write OOP code, etc!</p>
<h2>Ongoing development</h2>
<p>Doctrine 2 is still in Alpha at the moment and is constantly changing. Since we are using it actively in a project at the moment, we normally spot the changes pretty quickly and update the plugin to keep up, however we are not using all the aspects of the plugin (like generators, all the form widgets, etc) so from time to time something might completely fail when you svn up.</p>
<p>We are also trying to slowly, and safely (for BC) remove the need for ActiveEntity &#8211; but we&#8217;re being careful with this because we don&#8217;t want to break existing projects that are using it.</p>
<p>Report bugs in the usual way using the <a href="http://trac.symfony-project.org/newticket" target="_blank">symfony bug tracker</a> (if it&#8217;s plugin related) or on <a href="http://www.doctrine-project.org/jira/secure/CreateIssue!default.jspa" target="_blank">Doctrine Jira</a> (if you know it is a Doctrine issue). When reporting plugin bugs, please register the bug under the sfDoctrine component and <strong>add the keyword sfDoctrine2Plugin</strong> as I use a <a href="http://trac.symfony-project.org/query?status=new&amp;status=assigned&amp;status=reopened&amp;keywords=%7EsfDoctrine2Plugin&amp;order=priority" target="_blank">filtered query</a> to keep an eye on Doctrine 2 related issues.</p>
<h2>Coming in part 2&#8230;</h2>
<p>Will either be based on feedback/suggestions (if any) or I&#8217;ll move on to some real world examples and best practices when it comes to integrating symfony and Doctrine 2.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2010/03/using-doctrine-2-with-symfony-1-x-part1/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Is symfony the best documented OS project out there?</title>
		<link>http://eatmymonkeydust.com/2009/12/is-symfony-the-best-documented-os-project-out-there/</link>
		<comments>http://eatmymonkeydust.com/2009/12/is-symfony-the-best-documented-os-project-out-there/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 14:19:08 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=241</guid>
		<description><![CDATA[Introduction Well, I&#8217;m not actually going to answer that question because there are many thousands of projects and I don&#8217;t actually know how well they are all documented, so it would be completely unfair of me! However, with the release of this year&#8217;s advent calendar symfony is at least setting a high standard for others [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Well, I&#8217;m not actually going to answer that question because there are many thousands of projects and I don&#8217;t actually know how well they are all documented, so it would be completely unfair of me! However, with the release of <a href="http://www.symfony-project.org/blog/2009/12/01/one-more-thing">this year&#8217;s advent calendar</a> symfony is at least setting a high standard for others to follow.</p>
<h2>So what should you read?</h2>
<p>In our office, we have several symfony books kicking around, and new developers often ask where to start. In fact, it can be quite frustrating to have to tell a new guy that the 2 days they&#8217;ve spent studying the &#8220;Definitive guide to symfony&#8221; has really only helped them to maintain our first project from 2 years ago&#8230;</p>
<h3>Starting a new project &amp; don&#8217;t know much about symfony</h3>
<ul>
<li><a href="http://www.symfony-project.org/jobeet/1_4/Doctrine/en/" target="_blank">Do the Jobeet tutorial</a> &#8211; seriously, no matter how much you think you can wing it, don&#8217;t. Set aside a couple of days and go through it. It&#8217;s even supported by an svn repository so you don&#8217;t have to type much code if you don&#8217;t want to &#8211; although be aware that the documentation is much more up to date that the code behind it, so if in doubt, trust the doc. The tutorial is also available<a href="http://www.symfony-project.org/jobeet/1_4/Propel/en/" target="_blank"> in the Propel flavour</a>.</li>
<li><a href="http://www.symfony-project.org/reference/1_4/en/" target="_blank">Scan the reference guide</a> - I&#8217;m not saying read it, unless you have bags of time, but at least give it a quick scan so you know what&#8217;s there. When you&#8217;re struggling later you&#8217;ll think &#8220;I&#8217;ve seen that somewhere&#8221; &#8211; and chances are it was in the reference guide</li>
</ul>
<h3>Know the basics and want to take it further</h3>
<ul>
<li><a href="http://www.symfony-project.org/forms/1_2/en/" target="_blank">Read the forms book </a>- The newer versions of symfony still support the forms framework and chances are you will want to use it, so it&#8217;s a good idea to give this a read. You will have a good idea already after doing the <a href="http://www.symfony-project.org/jobeet/1_4/Doctrine/en/" target="_blank"> Jobeet tutorial</a> but there are things you will have missed and this will open your eyes.</li>
<li>Read <a href="http://www.symfony-project.org/advent_calendar/" target="_blank">More with symfony</a> (the 2009 advent calendar) - If you&#8217;ve started to get the hang of things and want to know what &#8220;the experts&#8221; do when they are coding with symfony, this is where to look! This book has been written by members of the symfony community, so comes totally from the perspective of experienced developers who have been through the same process as the one you are going through.</li>
<li><a href="http://www.symfony-project.org/cookbook/1_2/en/" target="_blank">Browse the cookbook</a> &#8211; If there is something you are wondering about that seems like it would be a common task, there might well be a &#8220;recipe&#8221; for that very task! The cookbook has not made it to the 1.4 branch of documentation at the time of writing, but most of the recipes (if not all) will work just fine in the later versions. </li>
<li>Check <a href="http://trac.symfony-project.org/wiki/" target="_blank">the wiki</a> - this is basically a cookbook with user supplied recipies, whereas the &#8220;official&#8221; cookbook is maintained by the core team. That&#8217;s not to say it&#8217;s any less of a resource &#8211; just that it&#8217;s slightly more likely to contain &#8220;opinions&#8221; and out of date ideas.</li>
</ul>
<h3>Stuck with something</h3>
<ul>
<li>Check through all of the above &#8211; in particular the <a href="http://www.symfony-project.org/reference/1_4/en/" target="_blank">reference guide</a> and <a href="http://www.symfony-project.org/cookbook/1_2/en/" target="_blank">cookbook</a>. &#8220;Googling&#8221; for a well structured phrase will often get you to one of the correct pages in the manual &#8211; just be sure to switch it to the correct version, as a lot of the old 1.0 pages still come up first in searches.</li>
<li>Browse the <a href="http://www.symfony-project.org/api/1_4/" target="_blank">API documentation</a> - The symfony codebase is generally very well commented, so if you are wondering about the methods of a particular class, or the options for a widget, or some other property/function/value that you can&#8217;t find anywhere in the documentation, there is a good chance the api docs will help you out.</li>
</ul>
<h2>Getting &#8220;human&#8221; help</h2>
<p>Sometimes all the reading and googling gets you nowhere and you can quickly find yourself feeling very frustrated and alone. Fortunately symfony is backed by an enourmous community, and in a rare web-community-twist it&#8217;s one that works both ways. Not only do people ask questions, but there are hundreds of people around to answer them too!</p>
<h3>My personal &#8220;hangouts&#8221;</h3>
<ul>
<li>IRC &#8211; Need a quick answer, this is the place.  You won&#8217;t <em>always </em>get a quick answer, because there are a lot of lurkers, but there are also a lot of &#8220;regulars&#8221; who hang around in there so be patient and try again a bit later if you don&#8217;t get a response straight away. Check out freenode channel #symfony (I&#8217;m rooster).</li>
<li><a href="http://forum.symfony-project.org/index.php" target="_blank">Symfony forum</a> - Not quite as well publicised as the Google groups, but a valuable resource all the same. It&#8217;s really down to your communication preferences if you like forums or mailing lists, so just pick one (or both). What you will find is that different people are active on the forum compared to the Google group &#8211; it&#8217;s a shame there is not much harmony here as it can be a bit strange for newcomers. One thing I will say about the forum is that you will <em>always</em> get a response, if not by anyone else at least by Halfer, Ryan or myself (Russ).</li>
<li>Google <a href="http://groups.google.com/group/symfony-users" target="_blank">symfony users group</a> - Very busy but with a lot of experienced developers around to answer questions. Can take a bit longer than the forum to get a response, but you are generally speaking to a larger audience here. You are more likely to get a response from Fabien if you post here, he hasn&#8217;t posted in the forum for 6 months! I&#8217;m RussMonkey in this one.</li>
<li><a href="http://trac.symfony-project.org" target="_blank">Trac</a> - If you have to come to the conclusion that what you are working with is a bug, or maybe it took you way to long to find the answer because the documentation on the subject was wrong, missing or just bad, then please raise a ticket. Depending on the nature of the issue, it can seem like it takes a while to get a response &#8211; so rather than &#8220;bumping&#8221; comments in the ticket itself, it&#8217;s normally best to start a discussion in an appropriate place, most likely the <a href="http://groups.google.com/group/symfony-devs" target="_blank">dev mailing list</a> and be sure to link to the discussion from the ticket, and link to the ticket in the discussion.</li>
</ul>
<h2>Staying &#8220;fresh&#8221;</h2>
<p>It&#8217;s quite hard to keep up with everything that&#8217;s going on, so there are a few things that you really should do:</p>
<ul>
<li>Subsribe to the <a href="http://www.symfony-project.org/blog/" target="_blank">symfony project blog</a> - this is where you&#8217;ll get the most important news about changes and future development from the core team.</li>
<li>Subscribe to the <a href="http://trac.symfony-project.org/wiki/SymfonyBloggers" target="_blank">symfony bloggers</a> feed &#8211; blog posts from the community, including this one, appear here. It has grown quite substantially lately, and can get cluttered with non-English blogs, which really should be in a seperate feed to be honest &#8211; but if you are using a feed reader you can just skip over them (unless you can read that particular language of course). There are a lot of experienced bloggers here, and you&#8217;ll start to recognise some of the more useful ones as you read.</li>
<li>Subscribe to the <a href="http://groups.google.com/group/symfony-users" target="_blank">user group mailing list </a>- either as a daily digest, or an rss feed (my preference). It&#8217;s useful to scan through and see what people are talking about, so you can recognise recurring problems and issues that you may face one day.</li>
<li>Those above things should take no more than a few minutes a day to browse and keep an eye on, but if you really want to get a bit more involved and have a bit more time to spare, then consider IRC, the forum and the dev mailing list also. </li>
</ul>
<h2>Summary</h2>
<p>So, you can see why I am starting to believe that symfony is at least one of the best documented and supported projects out there, in this post alone I have listed 14 resources that the developer can use can make the most of their time developing. Symfony has a (somewhat improving) reputation for being a one man show when it comes to the direction of the project and the core coding, but that is certainly not the case when it comes to the community support side of things &#8211; you are not alone!</p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2009/12/is-symfony-the-best-documented-os-project-out-there/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Session settings ignored?</title>
		<link>http://eatmymonkeydust.com/2009/10/php-session-settings-ignored/</link>
		<comments>http://eatmymonkeydust.com/2009/10/php-session-settings-ignored/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 16:43:37 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[configuration]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=229</guid>
		<description><![CDATA[I just read an extremely interesting post which explains an unwanted side effect of garbage collection by some Debian based systems. This cleanup process causes (maybe amongst other things) sessions to be cleared every 24 minutes, regardless of any ini setting you have set after the php.ini file is parsed (for example using ini_set() &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>I just read an <a href="http://elephpants.blog.linpro.no/2009/10/02/unwanted-end-of-sessions/">extremely interesting post</a> which explains an unwanted side effect of garbage collection by some Debian based systems. This cleanup process causes (maybe amongst other things) sessions to be cleared every 24 minutes, regardless of any ini setting you have set after the php.ini file is parsed (for example using ini_set() &#8211; if you are a symfony user, this is done during initialisation based on a setting in your factories.yml file).</p>
<p>Check it out: <a href="http://elephpants.blog.linpro.no/2009/10/02/unwanted-end-of-sessions/">http://elephpants.blog.linpro.no/2009/10/02/unwanted-end-of-sessions/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2009/10/php-session-settings-ignored/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Symfony forms &#8211; Flexible widgets based on user credentials (sfcontext is evil)</title>
		<link>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/</link>
		<comments>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 13:42:09 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[forms]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[best practice]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=215</guid>
		<description><![CDATA[Background This issue has come up many times in the symfony forum and on IRC, and whilst it seems like a fairly trivial one, it is important to discuss the best practice around it. Often we want to modify a form based on something outside the form&#8217;s scope, like a user&#8217;s credentials or the page [...]]]></description>
			<content:encoded><![CDATA[<h2>Background</h2>
<p>This issue has come up many times in the symfony forum and on IRC, and whilst it seems like a fairly trivial one, it is important to discuss the best practice around it. Often we want to modify a form based on something outside the form&#8217;s scope, like a user&#8217;s credentials or the page they are on, or maybe some session values &#8211; lets take the example of a dropdown widget where admin users get to see a few more options.</p>
<h2>The bad way</h2>
<p>Everyone that has been using symfony for a while is aware of the context singleton. This magic sprite allows us to grab all sorts of information about the context we are in, including the user, session, request, view, and many more things. Whilst it certainly has its place, most of the time, however, we should avoid using it. The clue to the reason why is carefully disguised in the class name &#8220;Context&#8221;.</p>
<p>When we refer to a context in our code, we are locking ourselves in to the fact that the context must exist, so every time we use it we are basically saying that this class can now only be used in a symfony project with a fully initialised symfony stack hanging over it.  This becomes a problem in things like unit tests, where you have to mock up a loaded context object with bells and whistles in order to test a simple function or class.</p>
<p>So this is what you might think of doing:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// In your form class</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configure<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$choices</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something boring&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something dull&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$currentUser</span> <span style="color: #339933;">=</span> sfContext<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$currentUser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAuthenticated</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$currentUser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hasCredential</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;admin&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$choices</span> <span style="color: #339933;">+=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something cool&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">6</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something leet&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// ....</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The reason this is bad is that the forms framework is a standalone framework &#8211; it should be possible to pick up your form class and drop it into any project. It should also be possible to test it independently of symfony, without being tied in by sfContext. So what is the better way?</p>
<h2>The dependency injection approach</h2>
<p>You might read that and think &#8220;woah, this is getting complicated!&#8221; but we&#8217;re not talking about dependency injection containers here, we&#8217;re simply saying that you can make your form object depend on something to run. The thing it depends on should not be the context singleton, it should be the minimum thing that the form needs to operate correctly &#8211; which in this case, is a user object that supports credentials.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// In your actions.class.php</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> myForm<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;currentUser&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// In your form class</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// ...</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;currentUser&quot;</span><span style="color: #009900;">&#41;</span> instanceof sfUser<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> InvalidArgumentException<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;You must pass a user object as an option to this form!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The test here is where we are making this form &#8220;dependent&#8221; on a user object. In this case we are insisting that the object is an instance of sfUser, which you may argue is tying us in to symfony again, but you could use any test here to ensure that the object will have the necessary functionality you need, maybe check for the existence of a &#8220;hasCredential()&#8221; method for example.</p>
<p>When writing a test for this form class, we now only need to instantiate a user object and load it with some credentials &#8211; much easier than doing the same thing and locking into a context singleton. There may be other times when this form could be useful in a lightweight environment, where you can get speedy access to a user object but don&#8217;t want the overhead of the symfony context &#8211; you might not think of one now, but it&#8217;s best to code this way and you&#8217;ll have less reasons to kick yourself further down the line.</p>
<h2>The completed code, for our single widget form</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// In your form class</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configure<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;currentUser&quot;</span><span style="color: #009900;">&#41;</span> instanceof sfUser<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> InvalidArgumentException<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;You must pass a user object as an option to this form!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$currentUser</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;currentUser&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000088;">$choices</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something boring&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something dull&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$currentUser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAuthenticated</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$currentUser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hasCredential</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;admin&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$choices</span> <span style="color: #339933;">+=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something cool&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">6</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;something leet&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my_dropdown'</span><span style="color: #009900;">&#93;</span>    <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormChoice<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;choices&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$choices</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my_dropdown'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorChoice<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;choices&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$choices</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Wrap up</h2>
<p>Think about this example the next time you think about modifying a query based on a user object, or session value in a peer class, or Doctrine table class&#8230; Maybe you should have passed a parameter there too? Every class and method you write, think about how you can reuse it, will it even be possible the way you have written it? If something simply <strong>must</strong> be coded in a symfony specific way, think about making a parent and a child class for the problem you are trying to solve. In the parent class, you can make things as generic as possible &#8211; so you can re-use that class to your heart&#8217;s content. In the child class, you can add the symfony specific code &#8211; kept to a minimum.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Doctrine Gotchas &#8211; delete cascade, SoftDelete and foreignType</title>
		<link>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/</link>
		<comments>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/#comments</comments>
		<pubDate>Sat, 16 May 2009 13:41:43 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[cascade]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[foreign key]]></category>
		<category><![CDATA[foreignType]]></category>
		<category><![CDATA[relations]]></category>
		<category><![CDATA[transitive persistence]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=204</guid>
		<description><![CDATA[These are mistakes anyone can make, as proved by our team of experienced developers who only came across these late into a project &#8211; after developing with Doctrine for over 6 months. Cascading / Transitive persistence In Doctrine there are two ways to define a cascade, one will tell Doctrine what to do, the other [...]]]></description>
			<content:encoded><![CDATA[<p>These are mistakes anyone can make, as proved by our team of experienced developers who only came across these late into a project &#8211; after developing with Doctrine for over 6 months.</p>
<h2>Cascading / Transitive persistence</h2>
<p>In Doctrine there are two ways to define a cascade, one will tell Doctrine what to do, the other defines how that condition is set up on your database when Doctrine builds the sql commands. The reason this was a gotcha for me, is that we only ever used one of the types, and were completely unaware of the other one! The Doctrine manual is quite long, and unless you&#8217;ve read it several times cover to cover it&#8217;s easy to miss these things &#8211; although next time I will at least be reading the appropriate section of the manual, regardless of what I <em>think</em> I already know.</p>
<p>So, you want a delete cascade? You might do something like this in your yaml file:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">PhoneNumber:
  columns:
    user_id:
      type: integer
  relations:
    User:
      class:       User
      local:       user_id
      foreign:     id
      onDelete:    CASCADE</pre></div></div>

<p>What the above definition says is that this phone number is connected to a user, and if the user record is deleted &#8211; in order to maintain database integrity with foreign keys, the corresponding phone number records should also be deleted. This is perfect behaviour &#8211; but Doctrine does not do anything with it, it simply sets up the database to handle it, so if you are using a dbms that supports delete cascades then everything will be handled at the database level.</p>
<h3>Adding softDelete to the equation</h3>
<p>So here comes the gotcha, all of our tables use the softDelete behaviour &#8211; which means that instead of the row being deleted, a flag is set (deleted=true) which then magically makes the row appear deleted in all your queries (Providing you have <a href="http://www.doctrine-project.org/documentation/manual/1_1/en/behaviors:core-behaviors:softdelete">dql callbacks turned on</a>). This means that the row is never actually deleted at the databse level, and thus the cascade is never applied. Now I always knew this, I mean I wouldn&#8217;t install a behaviour before knowing what it does right? What I wrongly assumed was that the call to onDelete: CASCADE would take care of &#8220;soft deleting&#8221; my relations too, but it doesn&#8217;t, in fact that line is effectively useless when combined with softDelete. For that you need to set the doctrine cascade parameter:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">PhoneNumber:
  actAs: [softDelete]
  columns:
    user_id:
      type: integer
  relations:
    User:
      class:       User
      local:       user_id
      foreign:     id
      foreignType: one
      cascade:     [delete]</pre></div></div>

<p>Now the behaviour will be as expected. If you are using softDelete and your application has a lot of delete operations, you should take some time to understand what is happening, because Doctrine must fetch and load all of the related objects and then check their relations and cascade settings and so on, so in a large system deleting a single user could result in quite a lot of database queries and cpu time. It is for this reason that database level cascades are preferable, so maybe being more picky about which models you apply the softDelete behaviour would be prudent. <a href="http://www.doctrine-project.org/documentation/manual/1_1/en/defining-models:transitive-persistence">Learn more about Doctrine Transitive Persistance</a>.</p>
<h2>Defining types of foreign key relations</h2>
<p>This one is also one of those &#8220;read the manual&#8221; situations, but similarly to the above example what caught us out here is that we again thought that there was only one option for defining what we wanted to do, when in fact there were too parameters we should have been considering. This gotcha also only applies if you are defining your relations in a yaml file, as the problem lies in its interpretation when Doctrine builds the base classes.</p>
<p>Look at the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">User:
  columns:
    id:
      type: integer
      notnull: true
  relations:
    Payment:
      class:       Payment
      local:       id
      foreign:     user_id
      foreignType: many</pre></div></div>

<p>The intention was that a user could have multiple payments, and it seemed to make sense to define it using the foreignType parameter above, however when the model was built &#8211; this always resulted in a $this-&gt;hasOne(&#8230;) statement being created, because what was actually happening is that we were not defining the relationship at the other end, we were actually defining it at the local end! So foreignType: many actually means &#8220;Many users can have one payment&#8221; &#8211; hence the interpretation of $this-&gt;hasOne(..)</p>
<p>In actual fact using the foreignType key is mostly useless, as Doctrine &#8220;guesses&#8221; this side of the relationship. It&#8217;s only necessary if Doctrine guesses incorrectly and you need to override it, our example above should actually have been using the &#8220;type&#8221; parameter, which defines the relationship from the other perspective:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">User:
  columns:
    id:
      type: integer
      notnull: true
  relations:
    Payments:
      class:    Payment
      local:    id
      foreign:  user_id
      type:     many</pre></div></div>

<p>Adding [ foreignType: one ] to this schema declaration would have no offect, as Doctrine would guess it to be the case (in this example). The above declaration will now correctly form a $this-&gt;hasMany(&#8230;) statement in your base class. To make it easy to remember, just forget about foreignType all together unless you come across a special case where you nee it &#8211; and prepend the word &#8220;has&#8221; to the type parameter, that should give you a clue as to what you are defining.</p>
<p>So, with one-to-one relationships, the type parameter is unnecessary, with one-to-many you specify the type: many (Doctrine will guess the one part) and with many-to-one you also do not need to specify the type as it will be guessed based on how you&#8217;ve got the relation set up from the other model&#8217;s perspective.</p>
<p><a href="http://www.doctrine-project.org/documentation/manual/1_1/en/defining-models:relationships:foreign-key-associations">Read more about relations in the Doctrine manual.</a></p>
<h2>Conclusion</h2>
<p>it&#8217;s hard to believe that after 6 months of coding a large application that currently has over 30,000 lines of code and growing we could have a schema file with several useless calls to onDelete: CASCADE and even more useless calls to foreignType. It&#8217;s even harder to believe that in the early days of the project, we simply overrode the setup methods to add the relations that we needed, when the Schema.yml file failed to come up with the goods. Next time I think I&#8217;ll spend a little more time with the documentation, although we are <em>of course</em> experts now &#8211; so maybe next time we won&#8217;t need to? <img src='http://eatmymonkeydust.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2009/05/doctrine-gotchas-delete-cascade-sofdelete-and-foreigntype/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>PHP TestFest Norway 2009</title>
		<link>http://eatmymonkeydust.com/2009/05/php-testfest-norway-2009/</link>
		<comments>http://eatmymonkeydust.com/2009/05/php-testfest-norway-2009/#comments</comments>
		<pubDate>Thu, 07 May 2009 14:33:34 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=198</guid>
		<description><![CDATA[If you use PHP and have ever wondered why you get something so cool for free, maybe a little tang of guilt can creep in. Contributing to the language in one way or another is a great way to pay something back, and there are many ways to do so, one of which is to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://php.no/node/323"><img class="alignright" title="TestFest logo Norwegian style" src="http://eatmymonkeydust.com/testfestnorway.jpg" alt="Test Fest Norway 2009" width="192" height="219" /></a></p>
<p>If you use PHP and have ever wondered why you get something so cool for free, maybe a little tang of guilt can creep in. Contributing to the language in one way or another is a great way to pay something back, and there are many ways to do so, one of which is to write tests&#8230;.</p>
<p>Tests keep the code sane. Every time things change, the tests can be run to make sure that everything still works ok &#8211; just like the php tests you (hopefully) write in your own projects. The best way to maintain this stability for the language itself is also to have as much code covered by tests as possible.</p>
<p>Every year, the PHP team organises <a href="http://qa.php.net/testfest.php">TestFes</a>t, aiming to introduce testing to the masses in the most straightforward way. All you have to do is find out where your nearest event is being held and sign up. You will be given everything you need and assisted in every way to help you write at least one test &#8211; hopefully many more.</p>
<p>Details of TestFest 2009 Norway have just been released, if you are in the area, <a title="TestFest 2009 Norway" href="http://php.no/node/323">check it out</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2009/05/php-testfest-norway-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customising Symfony forms &#8211; be careful with base class inheritence</title>
		<link>http://eatmymonkeydust.com/2009/03/customising-symfony-forms-be-careful-with-base-class-inheritence/</link>
		<comments>http://eatmymonkeydust.com/2009/03/customising-symfony-forms-be-careful-with-base-class-inheritence/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 14:12:25 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=92</guid>
		<description><![CDATA[Background Recently I was working on a form for updating a couple of very simple values for a single table. When creating such forms, where we only need a subset of the available columns to be editable, we always have the option of either unsetting the fields we don&#8217;t need, or overriding the widgetSchema. In [...]]]></description>
			<content:encoded><![CDATA[<h2>Background</h2>
<p>Recently I was working on a form for updating a couple of very simple values for a single table. When creating such forms, where we only need a subset of the available columns to be editable, we always have the option of either unsetting the fields we don&#8217;t need, or overriding the widgetSchema. In this case, I opted for the latter, since I only needed to edit 2 columns out of a possible 10, I didn&#8217;t think adding 8 fields to the unset() function was the cleanest way. The following examples contain obfuscated data.</p>
<h2>Overriding the widget schema</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configure<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setWidgets</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'amount'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'reduced_amount'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//Labels and decorator stuff here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>My plan was to inherit the validators that already exist in the base class, since they do the job for what I need.</p>
<h2>The error</h2>
<p>The form worked fine for an insert, but when I came to update an existing record, the error was quite strange:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SQLSTATE<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">23505</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span> Unique violation<span style="color: #339933;">:</span> <span style="color: #cc66cc;">7</span> ERROR<span style="color: #339933;">:</span> 
  duplicate <span style="color: #990000;">key</span> value violates unique constraint 
  <span style="color: #0000ff;">&quot;body_fee_version_pkey&quot;</span></pre></div></div>

<p>The problem it seemed was that my versionable behaviour was not incrementing the version value before attempting to insert a new version record. After a long period of debugging the versionable behaviour, along with some of my other custom behaviours, I was no closer to a solution.</p>
<p>I started to dig into the form classes, working backwords through all the object update methods, save, dosave, etc. Until I finally stumbled across this line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">values</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">clean</span><span style="color: #009900;">&#40;</span>
   <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">deepArrayUnion</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">taintedValues</span><span style="color: #339933;">,</span> 
   <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">convertFileInformation</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">taintedFiles</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Before this call, everything seemed ok, but after this call, my values array, which at this stage only contained the two fields that had been posted, now suddenly included a value for all the fields in the table. Why? It then occurred to me that the entire validator schema was being processed, not just the fields that are actually posted! This means that all the validators that are required=false will silently return a &#8220;clean&#8221; value, which is most likely the database default.</p>
<p>So what did this mean? Well, it meant that the validator was &#8220;cleaning&#8221; all the columns that had not been submitted with the form, including the version column, which was being set to null. When the versionable behaviour kicked in, it read this null value and incremented by 1 for the next version, which then became 1 &#8211; a version which of course already existed, causing the error.</p>
<h2>The solution</h2>
<p>The solution is blindingly simple, we don&#8217;t just declare the widget schema, we must also declare the validator schema. Whilst this seems like it makes sense, I feel that it is a shame that I have to essentially copy and paste the necessary validators from the base class. The alternative of course would have been to unset the offending fields, but then we are back to option 1 above, unsetting 8 of 10 fields when it seems cleaner just to declare the 2 fields I actially need.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setWidgets</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'amount'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'reduced_amount'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Messages declared here as array since they are the same</span>
&nbsp;
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setValidators</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">&quot;amount&quot;</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfNumberValidator<span style="color: #009900;">&#40;</span>
                       <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$messages</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">&quot;reduced_amount&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfNumberValidator<span style="color: #009900;">&#40;</span>
                       <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$messages</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">//Labels and decorator stuff here</span></pre></div></div>

<h2>Conclusion</h2>
</p>
<p>I have been working with Symfony for over a year and a half, and with Symfony forms since they were born &#8211; and yet I was still caught out by something that seems quite simple, because I assumed it would be ok. There are so many things that could have alerted me to this problem and saved me a lot of time, for example if any of the extra fields had been required=true then at least I would have had some form errors to give me a clue!</p>
<p>I may suggest that the default behaviour should be to only process the validators that match the widgets, or maybe at least for the form to err if extra validators are found that are not used, as I feel that this is a mistake that others could make, and as I mentioned above, it&#8217;s a shame that we have to re-declare validators that are already present in the base class.</p>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2009/03/customising-symfony-forms-be-careful-with-base-class-inheritence/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Redpill-Linpro at Symfony Camp, Dutch Open Projects 2008</title>
		<link>http://eatmymonkeydust.com/2008/09/redpill-linpro-at-symfony-camp-dutch-open-projects-2008/</link>
		<comments>http://eatmymonkeydust.com/2008/09/redpill-linpro-at-symfony-camp-dutch-open-projects-2008/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 16:20:04 +0000</pubDate>
		<dc:creator>Russ</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[symfony camp]]></category>

		<guid isPermaLink="false">http://eatmymonkeydust.com/?p=37</guid>
		<description><![CDATA[Intro Last Friday, reading Jonathan Wage&#8217;s Doctrine blog, I spotted a post in the top right hand corner which Read &#8220;Doctrine at Symfony Camp 2008&#8243;, and I thought &#8220;Symfony Camp&#8221;? Wassat? So I took a look and realised that this would be a great event to attend, as I&#8217;m currently between projects and about to [...]]]></description>
			<content:encoded><![CDATA[<h2>Intro</h2>
<p>Last Friday, reading <a title="Doctrine Blog" href="http://www.doctrine-project.org/blog/doctrine-at-symfony-camp2008" target="_blank">Jonathan Wage&#8217;s Doctrine blog</a>, I spotted a post in the top right hand corner which Read &#8220;Doctrine at Symfony Camp 2008&#8243;, and I thought &#8220;Symfony Camp&#8221;? Wassat? So I took a look and realised that this would be a great event to attend, as I&#8217;m currently between projects and about to move from Symfony 1.0 to Symfony 1.1/1.2.</p>
<p>Working for an open source company (<a title="Redpill-Linpro" href="http://www.linpro.no" target="_blank">Redpill-Linpro</a>) has it&#8217;s benefits &#8211; it took around an hour on Monday afternoon to gather interested parties (Hannes was the only one that could join me unfortunately), check with the boss(es), book flights, hire car and register. We were booked and ready to go.</p>
<h2>Day 0 &#8211; Polar Bears and Pizza</h2>
<p>We made it Gardermoen airport in plenty of time, noticing that the helpful monitor on the express train was informing us that our flight was delayed by an hour, giving us chance to play a couple of games of Hedgewars while we waited <img src='http://eatmymonkeydust.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Once we arrived in Amsterdam, I had the amusing pleasure of watching Hannes search in desperation for a place to smoke in a non-smoking airport, we grabbed our bags and then with a newly-chilled Icelander in tow proceeded to wind up the Alamo guy and get a nicely upgraded Volvo S40 hire car.</p>
<p>After a slight tour of the airport, TomTom took us to Amersfoort, where we drew out some €uros and looked in vain for  a place to eat. After giving up on the search (it was around 23:30 by now), we headed off to find the camp. TomTom took us to the correct road, but from that point on we were on our own &#8211; after driving down a road with an almost cartoon-like amount of road signs informing us of bends, obstructions, rabbits, etc. we found our headlights pointing down a cycle path. The sign showed a &#8220;dead end&#8221; symbol (&#8220;T&#8221; with a red top) and a couple of pictures of bikes an mopeds. On the floor was a dotted white line, separating the &#8220;road&#8221; into two sections barely big enough for a couple of bikes each. After consulting Hannes, we decided that this was not something we should be driving down, and headed back for a search of the area.</p>
<p>About 15 minutes later we were back driving down the &#8220;cycle path&#8221;. Yes, to get to Dutch Open Projects you have to drive down a cycle path &#8211; which &#8220;technically&#8221; is also a road, until just after the gate to their offices when a new sign informs you that only bikes may pass.</p>
<p>Hungry from our trip, we were pleased when offered some sandwiches by our new hosts which we munched on the way to setting up our camp beds in the military style tents. Everybody (except Fabien) was still up, so we joined &#8220;the Italians&#8221; and the beer started flowing.</p>
<p>During the rest of the &#8220;evening&#8221;, random shouts of &#8220;Polar Bear!&#8221; (aimed at Hannes), &#8220;Tantra!&#8221; (aimed at the Polish beer &#8220;Tatra&#8221; that was scattered about on the table and &#8220;Pizza!&#8221; (aimed at the Italians) kept us amused until around 4am, when I gave up and went to bed with a fag-smoke induced headache the size of a beach-ball.</p>
<p>While I tried to sleep, I was reminded of my current location by the constant shouts (see above), phone calls to Iceland and many general beer-fuelled activities, which fortunately involved avoiding the swimming pool. Early days yet&#8230;</p>
<p>On Thursday night there were relatively few people &#8211; on Friday there will be 80-90, more beer and a casino (With Symfony money no less). Stay tuned.</p>
<h2>Day 1 &#8211; Community, Casinos and Karaoke</h2>
<p>I woke up at about 5 past 10 to a sea of empty Italian beds, which was in plenty of time for the introductory fun and games at 10&#8230; hmm&#8230; well, anyway, by about 10:15 I had joined the conference and owing to the relaxed atmosphere here it was not embarrassing at all <img src='http://eatmymonkeydust.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Our Dutch host recreated a form of what he described as the Large Hadron Collider, although some may argue that it was just a line of red warning tape. We then proceeded to order ourselves in various categories, like how far we&#8217;d travelled (we were down at the end behind the Americans), how many Symfony apps we&#8217;d been part of, etc. It was clear that there was a broad mix of experience levels &#8211; Fabien at one end (of course) and Symfony virgins at the other.</p>
<p>Hannes was restful during most of the talks, but he made a noticeable shriek when Fabien mentioned that he considered PHP 5.3 to be PHP 6 because it wasn&#8217;t backwards compatible with 5.2&#8230; He quickly dozed off again though.</p>
<p>I won&#8217;t detail the talks here, since they will be well covered elsewhere, but we had an interesting day &#8211; often struggling to hear over the pounding rain but generally absorbing all the necessary info. We had a few chats about how the community can get more involved in the Symfony project, and some positive vibes were evident.</p>
<p>I have to mention that the barbecue was top notch, I had no less than <strong>3</strong> different types of veggie burger! They all tasted great along with the ample side salads and dressings &#8211; a welcome treat for me.</p>
<p>I also had a chat with <a title="Doctrine" href="http://www.doctrine-project.org/" target="_blank">Jonathan Wage</a> about one of our future projects and whether Doctrine could &#8220;handle&#8221; it. I appreciate his time going through it with me and showing me some code examples, and helping me to formulate some options that I could present to the project &#8211; top bloke.</p>
<p>The rest of the evening consisted of some nifty casino action with possibly the worlds best croupier. He was letting us &#8220;cheat&#8221; to an extent which made the game of Blackjack a whole lot more fun &#8211; and when the game was over half of the table had watches, phones, wallets, car keys and credit cards down for the final hand. Great stuff. Following that was karaoke, and yes I did sing 2 or 3 numbers after warming up with a song I can&#8217;t remember (edit: it was &#8220;Pretty Fly for a White Guy&#8221;) right now because REM is playing in the background as I write this.</p>
<p>By 2am the barbecues had been lit for &#8220;munchie time&#8221;&#8230; not that I&#8217;m implying anything.</p>
<h2>Day 2 &#8211; Write a ticket, submit a patch, write the documentation</h2>
<p>I woke up pretty late today, but I feel refreshed at least! Maybe enough to try the pool later if I can convince anyone to join me&#8230; The sun has come out but it&#8217;s still a bit chilly all the same.</p>
<p>The weekend has been good, not only for learning, but also for networking &#8211; now we&#8217;ll be able to put names to faces the next time we are talking to someone in #Symfony or checking the commit logs. It has also increased our understanding of the project and the people involved, which is very important when it comes to trusting it for future developments.</p>
<p>The night ended with &#8220;the Italians&#8221; making pasta for us, which was a real treat (including my vegetarian option &#8211; thanks guys) and lots of wine drinking until the early hours with a couple of the French guys. It was a pretty cold night, so we even sneakily moved our beds inside for a warmer night&#8217;s sleep! It&#8217;s late in the day on Sunday when I write this, so we&#8217;d better get a move on and get ourselves into the City to meet &#8220;the Italians&#8221; for lunch.</p>
<p>I&#8217;ll do some more updates once we&#8217;ve left, and also add a few photos at some point.</p>
<h2>Useful links</h2>
<ul>
<li><a title="Symfony Camp" href="http://www.symfonycamp.com" target="_blank">Symfony camp</a></li>
<li><a title="Symfony Project blog" href="http://www.symfony-project.org/blog/" target="_blank">Symfony Blog</a></li>
<li><a title="Aide de Camp - REST Support in Symfony 1.2" href="http://www.aide-de-camp.org/talk/16/symfony-camp-2008-REST" target="_blank">Rest support in Symfony 1.2</a> &#8211; Fabien Potencier<a title="Aide de Camp - REST Support in Symfony 1.2" href="http://www.aide-de-camp.org/talk/16/symfony-camp-2008-REST" target="_blank"><br />
</a></li>
<li><a title="Dependency injection in Symfony 2.0" href="http://www.aide-de-camp.org/talk/17/symfony-camp-2008-beyond-1-2" target="_blank">Dependency injection in Symfony 2.0</a> &#8211; Fabien Potencier</li>
<li><a title="Lessons learned at Yahoo" href="http://dustinwhittle.com/symfonycamp_lessons_learned_at_yahoo_with_notes.pdf" target="_blank">Lessons Learned at Yahoo!</a> &#8211; Dustin Whittle</li>
<li><a title="Fabian Langue - Symfony performance" href="http://www.slideshare.net/guest307465/full-stack-web-application-performance-tuning-presentation/" target="_blank">Symfony Performance</a> &#8211; Fabian Lange</li>
<li><a title="Doctrine" href="http://www.slideshare.net/guesta3af58/doctrine-php-object-relational-mapper-presentation" target="_blank">Doctrine</a> &#8211; Jonathan Wage</li>
</ul>
<ul>
<li><a href="http://www.slideshare.net/lambertbeekhuis/plugins-and-making-your-own-presentation/" target="_blank">Plugins and Making your own</a> &#8211; Lambert Beekhuis</li>
<li><a href="http://www.slideshare.net/francoisz/developing-for-developers-presentation/" target="_blank">Developing for developers &#8211; Usability Applied to Programming</a> &#8211; Francois Zaninotto</li>
<li><a href="http://pookey.co.uk/blog/archives/64-SymfonyCamp-Admin-Gen-Presentation.html" target="_blank">Admin generator</a> &#8211; Ian Christian</li>
<li><a href="http://www.slideshare.net/dustin.whittle/symfonycamp-yui-2008-presentation">Yahoo user interface libraries</a> &#8211; Dustin Whittle</li>
<li><a href="http://www.slideshare.net/skoop/debugging-with-symfony-presentation">Symfony debugging tools</a> &#8211; Stefan Koopmanschap</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://eatmymonkeydust.com/2008/09/redpill-linpro-at-symfony-camp-dutch-open-projects-2008/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

