<?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>woblog &#187; Rich</title>
	<atom:link href="http://www.whiteoctober.co.uk/blog/author/rsage/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whiteoctober.co.uk/blog</link>
	<description>great stuff about the web</description>
	<lastBuildDate>Fri, 02 Jul 2010 10:33:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>woPad</title>
		<link>http://www.whiteoctober.co.uk/blog/2010/04/16/wopad/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2010/04/16/wopad/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 14:27:52 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Cool stuff]]></category>
		<category><![CDATA[Web technologies]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=559</guid>
		<description><![CDATA[Well, not quite, but it was good to check that our site worked without problems on Apple&#8217;s latest offering :-)

I took a mini-break to New York last week, and had the chance to pop into the Apple store on 5th Avenue (I love how awesome that sounds).  Obviously then I had to try out [...]]]></description>
			<content:encoded><![CDATA[<p>Well, not quite, but it was good to check that our site worked without problems on <a href="http://www.apple.com/">Apple</a>&#8217;s <a href="http://www.apple.com/ipad/">latest offering</a> :-)</p>
<p><a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8988.jpg"><img src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8988-300x225.jpg" alt="The White October site rendered in Safari on the iPad" title="WO site on iPad" width="300" height="225" class="alignleft size-medium wp-image-560" /></a></p>
<p>I took a mini-break to New York last week, and had the chance to pop into the Apple store on 5th Avenue (I love how awesome that sounds).  Obviously then I had to try out the <a href="http://www.apple.com/ipad/">iPad</a> first-hand.  It was clearly the most popular item in-store as the gorgeous MacBook Pros and large iMac demonstration areas were practically empty, with large crowds around the iPad areas.</p>
<p><a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8989.jpg"><img src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8989-e1271428029999-225x300.jpg" alt="Crowds around the iPad demo areas" title="Crowds around the iPad demo areas" width="225" height="300" class="alignleft size-medium wp-image-561" /></a></p>
<p>It&#8217;s a nice device, if a little large for my liking, but very responsive, particularly with regards to the keyboard.  Positioning the iPad horizontally on the provided slanted stand allowed for typing on the on-screen keyboard at the same speed as you would a normal computer keyboard, and was extremely nice.  I was personally quite sceptical back in January when the product was announced, but I did find myself experiencing iPad-envy after playing with the device; travelling back to our hotel on the subway, I noticed about 4 people using them for various activities including reading books and browsing the web.  Suffice to say I restrained myself and didn&#8217;t purchase one sadly!</p>
<p>It&#8217;ll be interesting to see the UK release; by then hopefully all the little niggles will have been ironed out and we&#8217;ll have a solid product.  Watch this space :-)</p>
<p>Oh, and I also came across a stack of paper versions of <a href="http://www.theonion.com/">The Onion</a> hidden in a subway corridor. Very bizarre!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2010/04/16/wopad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony admin generator theming</title>
		<link>http://www.whiteoctober.co.uk/blog/2010/03/23/symfony-admin-generator-theming/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2010/03/23/symfony-admin-generator-theming/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 13:04:33 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=502</guid>
		<description><![CDATA[From this&#8230;

To this (at the click of a few generator.yml changes)!

As part of one of our current Symfony projects in work, a colleague and I decided that rather than reinventing the wheel everytime we used a new admin-generated module in the application with regards to overriding partials and actions in pretty much the same way [...]]]></description>
			<content:encoded><![CDATA[<p>From this&#8230;<br />
<a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/03/old-edit-user.jpg"><img class="alignleft size-medium wp-image-515" title="old-edit-user" src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/03/old-edit-user-300x154.jpg" alt="old-edit-user" width="300" height="154" /></a><br />
To this (at the click of a few <code>generator.yml</code> changes)!<br />
<a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/03/new-edit-user.jpg"><img class="alignleft size-medium wp-image-516" title="new-edit-user" src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/03/new-edit-user-300x179.jpg" alt="new-edit-user" width="300" height="179" /></a></p>
<p>As part of one of our current <a href="http://www.symfony-project.org/">Symfony</a> projects in work, a colleague and I decided that rather than reinventing the wheel everytime we used a new <a href="http://www.symfony-project.org/jobeet/1_4/Doctrine/en/12">admin-generated module</a> in the application with regards to overriding partials and actions in pretty much the same way each time, it would be productive and easier in the long run to create an admin generator theme.  The documentation on the Symfony site for this is sparse to say the least, and when I get some time, I&#8217;ll look at contributing back to the Symfony docs a condensed version of this blog post so that it’s a bit more straightforward for the next person.  You have the ability to customise pretty much every part of the admin generator including batch actions, form actions, filters, table headers and so on, so it&#8217;s worth the work in the long run if you&#8217;re looking for quick admin-generated module deployments in line with your site&#8217;s template.</p>
<p>OK, so before I start, be warned this is nice and long (and hopefully explanatory)&#8230;!  I&#8217;ll also say that <strong>clearing your cache</strong> upon making changes to partials is <strong>vital</strong>.  I repeat, <strong>VITAL</strong>! :-)</p>
<h2>Getting started</h2>
<p>The first step I carried out, which is mentioned on the Symfony site, was to copy all the files from the default theme into your project.  In our case, we&#8217;re using <a href="http://www.doctrine-project.org/">Doctrine</a> as the ORM, so the files were found in <code>lib/vendor/symfony/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin</code>, and they were copied to <code>data/generator/sfDoctrineModule/ourTheme</code>.  This directory contains 3 subdirectories – we&#8217;ll need all 3.  The names should be self-explanatory &#8211; &#8220;<code>parts</code>&#8221; consists of all the parts needed to dynamically generate the code, &#8220;<code>skeleton</code>&#8221; consists of skeleton files that form the basis of the final module (<code>generator.yml</code> etc), and &#8220;<code>template</code>&#8221; consists of the template files that use the files in &#8220;<code>parts</code>&#8220;. Simple!</p>
<p>That&#8217;s the basic step out of the way.  If you want to check that everything is being correctly read here, simply alter an existing generator.yml file as follows:</p>
<p><code>theme:    ourTheme</code></p>
<p><strong>Clear your cache</strong>, and reload your page.  You shouldn&#8217;t see any change – this is because the files are exactly the same as the default theme.  Now comes the fun part!</p>
<p>For the following paths, I&#8217;ll assume the prefix of <code>data/generator/sfDoctrineModule/ourTheme/</code> to avoid typing it out each time.</p>
<h2>Adding configuration options</h2>
<p>The first change I wanted to carry out was to add some extra configuration options via the <code>generator.yml</code> file.  One major gripe I have with the Symfony admin generator is that once you&#8217;ve added a new object, or edited one, the default destination is the edit page, rather than the list page.  Personally I see returning to the list as expected behaviour, and every project I use the admin generator in, I end up overriding the <code>processForm()</code> action and making this change.  I wanted to be able to specify this destination via a configuration option on the &#8216;new&#8217; and &#8216;edit&#8217; contexts, with a &#8216;return_to&#8217; option.  Carrying out this change involves overriding some other classes in Symfony, most notably the <code>sfModelGeneratorConfiguration</code> class.  I copied this class from the Symfony core to <code>lib/generator/myModelGeneratorConfiguration.class.php</code>.</p>
<p>Once you&#8217;ve done this, alter <code>parts/configuration.php</code> so that the generated class extends from <code>myModelGeneratorConfiguration</code> instead of <code>sfModelGeneratorConfiguration</code>.</p>
<p>Open up this class, and you&#8217;ll see a lot of abstract methods defined near the top.  These methods are created during the generation process, and are located in the <code>parts/fieldsConfiguration.php</code> file.  You&#8217;ll see that it consists of what looks like PHP within PHP – this is a common theme throughout the development of an admin generator theme, and can get a tad confusing if you forget what context you&#8217;re in when you&#8217;re writing code!  You can use the example methods to build your own.  In my case, I added the following:</p>
<p><code>public function getNewReturnTo()<br />
{<br />
return '&lt;?php echo $this-&gt;escapeString(isset($this-&gt;config['new']['return_to']) ? $this-&gt;config['new']['return_to'] : 'edit') ?&gt;';<br />
&lt;?php unset($this-&gt;config['new']['return_to']) ?&gt;<br />
}</code><br />
<code><br />
public function getEditReturnTo()<br />
{<br />
return '&lt;?php echo $this-&gt;escapeString(isset($this-&gt;config['edit']['return_to']) ? $this-&gt;config['edit']['return_to'] : 'edit') ?&gt;';<br />
&lt;php unset($this-&amp;gtconfig['edit']['return_to']) ?&gt;<br />
}<br />
</code><br />
These methods both return a configuration value if it exists in the YAML file, or the defaults of &#8216;new&#8217; and &#8216;edit&#8217; respectively if no configuration value is specified.</p>
<p>In order to make this option available in the configuration, the <code>myModelGeneratorConfiguration-&gt;compile()</code> method should be altered to allow this option:</p>
<p><code>// ...<br />
'new'    =&gt; array(<br />
'fields'  =&gt; array(),<br />
'title'   =&gt; $this-&gt;getNewTitle(),<br />
'actions' =&gt; $this-&gt;getNewActions() ? $this-&gt;getNewActions() : $this-&gt;getFormActions(),<br />
'return_to' =&gt; $this-&gt;getNewReturnTo()<br />
),<br />
// …<br />
</code></p>
<p>and the same for the edit option.  The final change is to actually action this change in the <code>processForm()</code> method, conveniently found in <code>parts/processFormAction.php</code>.  This file (along with all the other <code>*Action.php</code> files) are included in the generated <code>sfActions</code> class specific to the module you&#8217;re creating.  I removed the final redirect line which redirected back to the &#8216;edit&#8217; URL, and replaced it with the following changes:</p>
<p><code>// ...<br />
if ($form-&gt;isValid())<br />
{<br />
$thisContext = $form-&gt;getObject()-&gt;isNew() ? 'new' : 'edit';<br />
$notice = $form-&gt;getObject()-&gt;isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';</code><br />
<code><br />
// ...<br />
$this-&gt;redirect('@&lt;?php echo $this-&gt;getUrlForAction('new') ?&gt;');<br />
}<br />
else<br />
{<br />
$route = '&lt;?php echo $this-&gt;getSingularName(); ?&gt;';<br />
$returnTo = strtolower($this-&gt;configuration-&gt;getValue($thisContext . '.return_to'));<br />
if ($returnTo != 'list')<br />
{<br />
$route .= '_' . $returnTo;<br />
}</code><br />
<code><br />
$returnArray = array('sf_route' =&gt; $route);<br />
if ($returnTo != 'list')<br />
{<br />
$returnArray['sf_subject'] = $&lt;?php echo $this-&gt;getSingularName(); ?&gt;;<br />
}<br />
$this-&gt;redirect($returnArray);<br />
</code></p>
<p>That&#8217;s it! Add the configuration option into your generator.yml as follows:<br />
<code>new:<br />
return_to: list<br />
</code></p>
<p><strong>Clear your cache</strong>, reload the page and test it out.  After creating a new object, you should be returned to the list.  This is restricted to eg <code>my_model_ACTION</code>-type routes, but you can easily enhance the above code to redirect to any other route, check for an &#8220;@&#8221; symbol if needs be and so on.</p>
<h2>New &#8220;contexts&#8221;</h2>
<p>I wanted to implement an Ajax edit form on a &#8220;view&#8221; page for my model, so that the user wasn’t taken away.  The templates I was working from had this as a pop-over box, but instead of redirecting the user afterwards, I wanted the edit and update to be seamless.  In terms of the form, the ajax form was similar (but slightly different) to the normal admin-generated edit form, so I wanted the ability to be able to configure the form separately from the edit page.</p>
<p>I experimented with configuring it as part of my &#8216;view&#8217; context but ran into problems with nested array configurations, so I decided to abstract it out and create a new &#8220;context&#8221; with which I could configure items in the same way as a normal context (&#8216;new&#8217;, &#8216;edit&#8217;, &#8216;list&#8217; and so on).  I termed this &#8216;ajaxedit&#8217;;  NB I’m calling them &#8216;contexts&#8217; here as I’m sure I read that’s what they were called somewhere! Correct me if not ;-)</p>
<p>The creation of this is very similar to the above changes for adding a configuration value.  In <code>myModelGeneratorConfiguration.class.php</code>, add the following in to the configuration array in <code>compile()</code>:</p>
<p><code>'ajaxedit' =&gt; array(<br />
'title'   =&gt; $this-&gt;getAjaxeditTitle(),<br />
'actions' =&gt; $this-&gt;getAjaxeditActions() ? $this-&gt;getAjaxeditActions() : $this-&gt;getFormActions(),<br />
'fields'  =&gt; array()<br />
</code></p>
<p>I added this after the &#8216;edit&#8217; one currently there.  If you proceed down through this method, I also duplicated the &#8216;edit&#8217; line in the first <code>foreach()</code> loop, where the fields are configured using <code>sfModelGeneratorConfigurationField</code>, and altered &#8216;edit&#8217; to &#8216;ajaxedit&#8217; where appropriate.  Same in the &#8216;virtual fields&#8217; configuration, the form actions, the field configuration (duplicated from &#8216;list field configuration&#8217;), and the <code>$this-&gt;parseVariables()</code> lines.</p>
<p>You should also add &#8216;ajaxedit&#8217; to the credentials array near the end of the <code>compile()</code> method, so that you can control access to the popup/context with credentials, and again into the <code>getConfig()</code> method at the end of the class.</p>
<p>You then need to create the relevant abstract methods as before, so that the context can be correctly configured.  Again, I used the &#8216;edit&#8217; context as an example to base my changes and additions on.</p>
<p>The next step is to configure the templates and partials so that they recognise this.  I used the default <code>_form.php</code> partial so that I could re-use code where possible, but added a &#8216;context&#8217; variable to the partial when calling it, eg. in my view page:</p>
<p><code><br />
[?php include_partial('&lt;?php echo $this-&gt;getModuleName() ?&gt;/form', array('&lt;?php echo $this-&gt;getSingularName() ?&gt;' =&gt; $&lt;?php echo $this-&gt;getSingularName() ?&gt;, 'form' =&gt; $form, 'configuration' =&gt; $configuration, 'helper' =&gt; $helper, 'context' =&gt; 'ajaxedit')) ?]<br />
</code></p>
<p>In my form partial, I then altered the <code>getFormFields()</code> call to the following:</p>
<p><code><br />
[?php foreach ($configuration-&gt;getFormFields($form, $form-&gt;isNew() ? 'new' : 'edit') as $fieldset =&gt; $fields): ?]<br />
</code></p>
<p>so that I was using the correct set of fields for the form display.  Don&#8217;t forget to <strong>clear your cache</strong> after making these changes.</p>
<p>You can handle the ajax post however you like; I used <a href="http://jquery.com/">jQuery</a> and a callback handler to adjust details and display new values etc where required.  The handling of the form data was done in the same way as a normal Symfony action; details of this (and Ajax-specific stuff) are in the main Symfony documentation.</p>
<p>Here&#8217;s the result:<br />
<a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/03/ajax-edit.jpg"><img class="alignleft size-medium wp-image-522" title="ajax-edit" src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/03/ajax-edit-300x196.jpg" alt="ajax-edit" width="300" height="196" /></a></p>
<h2>Conclusion</h2>
<p>The one major thing to remember is that <strong>clearing your cache</strong> is <strong>VITAL</strong> to a speedy admin generator theme development.  If you&#8217;re running in dev mode via your front controller, then Symfony will only regenerate partials that are directly related to your <code>generator.yml</code> on the fly.  It won&#8217;t recreate action templates if there is no need to from <code>generator.yml</code> changes.  This means that you will need to manually call &#8220;<code>./symfony cc</code>&#8221; from the command line whenever you make changes to partials.  I lost count of how many times I ran that task during my theme development :-)</p>
<p>I&#8217;d imagine there are nicer ways to do some of the above – I&#8217;m not particularly a fan of the overriding of classes and having them separate from the theme, although I know that Symfony&#8217;s autoloading can be pretty clever sometimes, so it would probably find the classes with a bit of tweaking, if I put them as part of the theme.  It&#8217;s also a bit tricky to get your head around the whole PHP-creating-PHP idea, and remembering whereabouts you are, and what variables you have available to you.  I lost a good few hours trying to use variables that were in the top-level PHP, in my generated partials, and wondering why they weren’t working.</p>
<p>However, the end result is definitely worth it and saves a lot of time in the long run if you&#8217;re looking to re-use templates and code across a number of admin-generated modules!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2010/03/23/symfony-admin-generator-theming/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP UK Conference 2010</title>
		<link>http://www.whiteoctober.co.uk/blog/2010/03/05/php-uk-conference-2010/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2010/03/05/php-uk-conference-2010/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 17:15:41 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[Web technologies]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=491</guid>
		<description><![CDATA[Last Friday (26 February 2010), myself and Ed Lucas from White October took a trip down the M40 to the PHP UK Conference 2010, hosted at the Business Design Centre in London.  The purpose of the trip was three-fold &#8211; firstly to attend some great talks, secondly to socialise and meet other members of the [...]]]></description>
			<content:encoded><![CDATA[<p>Last Friday (26 February 2010), myself and <a title="Ed Lucas" href="http://www.whiteoctober.co.uk/blog/author/elucas/">Ed Lucas</a> from White October took a trip down the M40 to the <a title="PHP UK Conference 2010" href="http://www.phpconference.co.uk/">PHP UK Conference 2010</a>, hosted at the Business Design Centre in London.  The purpose of the trip was three-fold &#8211; firstly to attend some great talks, secondly to socialise and meet other members of the PHP community, and thirdly to see if we could recruit any budding new junior PHP developers (we failed on the last part but <a href="http://www.whiteoctober.co.uk/contact-_3/">get in touch</a> if you&#8217;re interested in working for a great web agency in Oxford).</p>
<p>The conference kicked off with the keynote speech delivered by <a href="http://joshholmes.com/">Josh Holmes</a>, on &#8220;The lost art of simplicity&#8221;.  This was a great keynote &#8211; some of the feedback I&#8217;ve read since the conference describes it as &#8220;nothing new&#8221;, or &#8220;knew this already&#8221; but regardless of whether you knew it already or not, it&#8217;s all too easy to forget about making things simple.  An example that stuck in my mind from the keynote was if a client asks for a report&#8230; and they&#8217;re delivered a report system.  Error, not what the client asked &#8211; they don&#8217;t care about a system to do it, they just want to know how many pencils they have in stock etc.  This seemed to ring true with a large majority in the room! It&#8217;s something that we at White October try and build into systems/sites we produce, so that the client has as much hands-on control as they need, without fancy technology or &#8220;cool ideas&#8221; getting in the way.</p>
<p>After the keynote, Ed and I split off to attend talks in our areas of interest.  My first stop was <a href="http://www.leftontheweb.com/">Stefan Koopmanschap</a>&#8217;s talk on documentation.  Another area which seems to get forgotten about! Stefan gave some great examples of how to get documentation done effectively, eg by getting your users to write the user manual (NOT the developers!).  In particular, he included &#8220;obvious&#8221; documentation methods which may be forgotten about, such as commit messages, <a href="http://en.wikipedia.org/wiki/PHPDoc">DocBlock</a> comments in code and unit/functional tests (we all do those, right?).  These all make for a much more maintainable system.  Great talk &#8211; extremely useful.</p>
<p>The lunchtime talk was given by <a href="http://www.symfony-project.org/">Symfony</a> legend <a href="http://fabien.potencier.org">Fabien Potencier</a>, on new features in PHP 5.3 and how to solve real problems using new features.  The ubiquitous &#8220;lambda functions&#8221; came up, used as part of the example of the <a href="http://symfony-reloaded.org/">Symfony 2</a> <a href="http://components.symfony-project.org/dependency-injection/">Dependency Injection</a> container.  Thoughts are divided in the WO camp on dependency injection, but I think once we shift to Symfony 2 and start using it in practice, it will make much more sense.  We also ambushed Fabien at lunch regarding the possibility of open-sourcing/releasing Sismo (the Symfony continuous integration server) but sadly it appears that&#8217;s not meant to be!</p>
<p>After lunch I attended the &#8220;hidden features&#8221; talk by <a href="http://schlueters.de/">Johannes Schluter</a> which was interesting, if a little disjointed.  In particular, I discovered useful applications of <a href="http://uk2.php.net/streams">streams</a> eg for processing zip files, and  the PECL &#8216;<a href="http://pecl.php.net/package/inclued">inclued</a>&#8216; package which shows you your require/include() calls. Handy stuff.  This talk was followed by &#8220;Regex-fu&#8221;, by <a href="http://www.adviesenzo.nl/">Juliette Folmer</a> &#8211; lots of sweet-throwing around the room for correct answers to questions; highly entertaining! I picked up a good few tips here, and enjoyed the explanations of how regular expressions work internally in terms of optimizing them etc.  I haven&#8217;t seen a talk with quite so many random characters being drawn on the presentation whiteboard before however&#8230;</p>
<p>The final talk we both attended was &#8220;Best practices for web service design&#8221; by <a href="http://www.lornajane.net/">Lorna Jane Mitchell</a>.  This was an excellent talk, littered with real-world anecdotes from Lorna, and included again some &#8220;obvious&#8221; ideas/guidelines which I&#8217;d imagine we all forget to do from time to time! Things like stacking errors, presenting a consistent interface in terms of response codes etc, keeping as small an API as is needed for operation &#8211; all useful stuff, and a good way to end the talks of the day.</p>
<p>After the talks finished, <a href="http://www.facebook.com/">Facebook</a> kindly provided a large amount of free beverages, which we all were only to happy to partake in.  We met some interesting people during the next few hours, and tried our best to recruit budding junior developers&#8230; and failed.  Seems like everyone was recruiting at this year&#8217;s conference! We then headed back up to WO HQ in Oxford.</p>
<p>There were a reasonable number of stands, and varied ones at that, which was good.  The <a href="http://oreilly.com/">O&#8217;Reilly</a> stand seemed to get a large amount of attention; probably due to the great discount available! It was also good to see the <a href="http://www.data.gov.uk/">data.gov.uk</a> stand in attendance, if a little sparse each time I glided past&#8230;</p>
<p>Anyway, a massive thanks to the <a href="http://www.phplondon.org/">PHP London</a> guys, for putting on a great conference &#8211; definitely looking forward to next year&#8217;s!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2010/03/05/php-uk-conference-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hudson and Symfony continuous integration</title>
		<link>http://www.whiteoctober.co.uk/blog/2010/02/05/hudson-and-symfony-continuous-integration/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2010/02/05/hudson-and-symfony-continuous-integration/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 15:02:34 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Test Driven Development]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=460</guid>
		<description><![CDATA[We&#8217;ve been experimenting this week with using Hudson as our continuous integration server for our latest Symfony project.  Previous experiences with CruiseControl via phpUnderControl and the symfonyUnderControl plugin were OK-ish but we&#8217;d occasionally experience CruiseControl dying on us with no warning apart from the lack of emails after checking our code in.
So we decided it [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been experimenting this week with using <a title="Hudson" href="http://hudson-ci.org/">Hudson</a> as our continuous integration server for our latest <a href="http://www.symfony-project.org/">Symfony</a> project.  Previous experiences with <a title="CruiseControl" href="http://cruisecontrol.sourceforge.net/">CruiseControl</a> via <a title="phpUnderControl" href="http://phpundercontrol.org/">phpUnderControl</a> and the <a title="symfonyUnderControl" href="http://www.symfony-project.org/plugins/symfonyUnderControlPlugin">symfonyUnderControl</a> plugin were OK-ish but we&#8217;d occasionally experience CruiseControl dying on us with no warning apart from the lack of emails after checking our code in.</p>
<p>So we decided it was time to perhaps investigate alternatives.  The obvious choice for Symfony would be to use <a title="Sismo" href="http://ci.symfony-project.org/">Sismo</a>, but sadly it hasn&#8217;t been released yet&#8230; <a title="Fabien Potencier" href="http://fabien.potencier.org">Fabien</a>, any clues as to a release date? ;-) It looks at the moment as if we&#8217;re stuck with a Java-based solution, so we decided to look at Hudson as an alternative.</p>
<p>Setting up Hudson was straightforward using <a title="Hudson and Symfony by Nicolas Perriault" href="http://prendreuncafe.com/blog/post/2009/10/06/Simple-Continuous-Integration-of-a-Symfony-Project-using-Hudson">Nicolas Perriault&#8217;s blog post</a> on exactly what we were trying to achieve, linking in with our Subversion repository.  The configuration of the projects took a bit of faffing &#8211; for some reason, Hudson liked to check out the whole repository rather than just eg the trunk folder  as specified, so this screwed up some of the paths.  A bit of trial and error later and we were up and running with a build every 30mins if there are new commits, as this pretty graph shows&#8230; (using the jUnit XML output available in Symfony 1.4).  Total number of tests in blue, failures in red.</p>
<p><img class="alignleft size-medium wp-image-461" title="Hudson build trend output" src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/02/build-trend-300x120.png" alt="Hudson build trend output" width="300" height="120" /></p>
<p>One thing to bear in mind if you&#8217;re getting test failures randomly, or perhaps always after a certain developer checks in (and it&#8217;s not a result of broken code) is to ensure that the permissions are correct for Symfony, as SVN likes to store permissions where it can.  The fix for this, apart from committing new permissions, is to add a build step in Hudson that carries out ./symfony project:permissions (Symfony 1.3+) shortly before the build.  This seems to solve it nicely, and explained the small red peaks in the graph above.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2010/02/05/hudson-and-symfony-continuous-integration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t be afraid to NOT use the ORM&#8230;</title>
		<link>http://www.whiteoctober.co.uk/blog/2009/10/16/dont-be-afraid-to-not-use-the-or/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2009/10/16/dont-be-afraid-to-not-use-the-or/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 15:06:03 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[Web technologies]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=353</guid>
		<description><![CDATA[I&#8217;ve been racking my brains the past couple of days with a Doctrine issue within a Symfony project.  I was constructing a bank statement-esque page, which iterated over a &#8220;StatementEntry&#8221; table and displayed the results.  Entries could either be of model Type A or model Type B, with the relevant model ID stored [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been racking my brains the past couple of days with a <a title="Doctrine" href="http://www.doctrine-project.org/">Doctrine</a> issue within a <a title="Symfony" href="http://www.symfony-project.org/">Symfony</a> project.  I was constructing a bank statement-esque page, which iterated over a &#8220;StatementEntry&#8221; table and displayed the results.  Entries could either be of model Type A or model Type B, with the relevant model ID stored in the StatementEntry table.  The relationship was defined by a &#8220;type&#8221; column.  Type A and B models also had other relationships after the initial one.</p>
<p>The problem I discovered was that obviously Doctrine didn&#8217;t know what the conditional relationships were, since it was dependant on the type column.  I researched some different approaches:</p>
<ol>
<li> <strong>Doctrine&#8217;s RawSql</strong>
<p>This approach worked for generating the correct SQL query without a problem, but the issue then arose of how Doctrine could hydrate the result set.  Answer was &#8211; it couldn&#8217;t :-) Well, I lie &#8211; I could use Doctrine::HYDRATE_SCALAR but I had issues with other related models, where I was joining to a table twice but under different aliases, which failed, since the scalar hydration would override earlier joins on the same table.</li>
<li> <strong>Column aggregation</strong>
<p>Column aggregation looked great initially &#8211; I could have a &#8220;TypeAEntry&#8221; and a &#8220;TypeBEntry&#8221;, and Doctrine would have handled the typing of the Entry automatically.  I couldn&#8217;t however see a way to query &#8220;in reverse&#8221; &#8211; get all Entries and their associated models.</li>
<li> <strong>Write a raw SQL query, and use Doctrine&#8217;s PDO instance to retrieve the data.</strong></li>
</ol>
<p>Option 3) was the one I settled for in the end.  It meant of course that I had to specify column names, and perform all the joins myself, but it did mean I could specify precisely what data I wanted back.  This came back in the form of a normal array.  I&#8217;d tried to stay away from this option intially, but after spending too long researching the other 2 and hitting brick walls, I bit the bullet and dropped down to the raw stuff.  And hey presto!</p>
<p>Note &#8211; this approach will only work if you want the data to be read-only.  If you want to then use Doctrine&#8217;s model goodness, you&#8217;ll need to work out how to transform that *back* into a model.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2009/10/16/dont-be-afraid-to-not-use-the-or/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
