<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Symfoniac</title>
	<atom:link href="http://symfoniac.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://symfoniac.wordpress.com</link>
	<description>Arthur Koziel on symfony</description>
	<lastBuildDate>Wed, 07 May 2008 18:43:28 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='symfoniac.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/78e60ed3230ec783c9f755fcb5de5f1a?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Symfoniac</title>
		<link>http://symfoniac.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://symfoniac.wordpress.com/osd.xml" title="Symfoniac" />
		<item>
		<title>Installing Symfony 1.1 svn beside 1.0 stable</title>
		<link>http://symfoniac.wordpress.com/2007/12/22/installing-symfony-11-svn-beside-10-stable/</link>
		<comments>http://symfoniac.wordpress.com/2007/12/22/installing-symfony-11-svn-beside-10-stable/#comments</comments>
		<pubDate>Sat, 22 Dec 2007 13:13:58 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[multiple-versions]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[symfony1.1]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[virtual hosts]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/12/22/installing-symfony-11-svn-beside-10-stable/</guid>
		<description><![CDATA[Announcements about Symfony 1.1 are becoming more frequent and with the creation of the 1.1 branch many users want to try it out and simply play around with 1.1 during the holiday season.
This guide is derived from InstallingMultipleVersionsOfSymfony and assumes you already have Symfony 1.0 installed (via PEAR) and running. Also note that i will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=55&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/12/439196_belong_together.jpg?w=178&#038;h=118" alt="Symfony 1.0 and 1.1 together! ;-)" align="left" height="118" width="178" />Announcements about Symfony 1.1 are becoming more frequent and with the creation of the 1.1 branch many users want to try it out and simply play around with 1.1 during the holiday season.</p>
<p>This guide is derived from <a href="http://trac.symfony-project.com/wiki/InstallingMultipleVersionsOfSymfony">InstallingMultipleVersionsOfSymfony</a> and assumes you already have Symfony 1.0 installed (via PEAR) and running. Also note that i will use the PEAR directory to store Symfony 1.1 alongside my 1.0 installation, you can however put it wherever you like.</p>
<p>First off, check where your current Symfony installation is located. You could for example look at one of your projects &#8220;<i>config/config.php&#8221;</i> file &#8211; in my case it&#8217;s &#8220;<i>/usr/lib/php/pear/symfony</i>&#8220;, therefore i will be installing Symfony 1.1 one level above into &#8220;<i>/usr/lib/php/pear</i>&#8220;.</p>
<p>Create a directory for your installation and check out the current 1.1 branch:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;font-size:14px;color:#000000;">sudo mkdir <span style="color:#40015a;">/usr/lib/php/pear/symfony_11</span><span style="color:#bb7977;font-weight:bold;">
cd</span> <span style="color:#40015a;">/usr/lib/php/pear/symfony_11</span>
sudo svn co http<span style="color:#808030;">:</span><span style="color:#40015a;">/</span><span style="color:#40015a;">/svn</span><span style="color:#800000;font-weight:bold;">.</span>symfony-project<span style="color:#800000;font-weight:bold;">.</span><span style="color:#40015a;">com/branches/1</span><span style="color:#800000;font-weight:bold;">.</span><span style="color:#008c00;">1</span> <span style="color:#800000;font-weight:bold;">.</span></pre>
<p>After the checkout is done, the next step is to create a symlink to the &#8220;<i>symfony</i>&#8221; php executable of the 1.1 checkout. You can find out where your current <i>symfony</i> command is stored with:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;font-size:14px;color:#000000;">whereis symfony</pre>
<p>In my case it&#8217;s located in &#8220;<i>/usr/bin/</i>&#8220;, that&#8217;s also where i will create the new symlink:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;font-size:14px;color:#000000;">sudo ln <span style="color:#44aadd;">-s</span> <span style="color:#40015a;">/usr/lib/php/pear/symfony_11/data/bin/symfony</span> <span style="color:#40015a;">
/usr/bin/symfony1</span><span style="color:#800000;font-weight:bold;">.</span><span style="color:#008c00;">1</span></pre>
<p>(<b>Note:</b> It&#8217;s important to use absolute paths here)</p>
<p>With this done, you will still have your usual &#8220;<i>symfony</i>&#8221; command which is linked against your stable PEAR version but also a new &#8220;<i>symfony1.1</i>&#8221; command which is linked against your subversion checkout.<br />
You can verify it easily by executing each command with the -V parameter.</p>
<p>If everything is working,  create a new symfony 1.1 project (as you might already know, Symfony 1.1 features new CLI commands, you can see them by executing the &#8220;<i>symfony1.1</i>&#8221; command):</p>
<pre style="background:#ffffff none repeat scroll 0 50%;font-size:14px;color:#000000;">mkdir sf11test <span style="color:#800080;">&amp;&amp;</span> <span style="color:#bb7977;font-weight:bold;">cd</span> <span style="color:#800000;font-weight:bold;">!</span>$
symfony1<span style="color:#800000;font-weight:bold;">.</span><span style="color:#008c00;">1</span> generate<span style="color:#808030;">:</span>project foobar
symfony1<span style="color:#800000;font-weight:bold;">.</span><span style="color:#008c00;">1</span> generate<span style="color:#808030;">:</span>app frontend
symfony1<span style="color:#800000;font-weight:bold;">.</span><span style="color:#008c00;">1</span> generate<span style="color:#808030;">:</span>module frontend helloworld</pre>
<p>Finally, the only thing left to do is to create a Virtual Host, it&#8217;s identical to the ones you created for your Symfony 1.0 project except for the path, don&#8217;t forget to change it to the location of your symfony 1.1 branch!</p>
<div>
<pre style="background:#ffffff none repeat scroll 0 50%;font-size:14px;color:#000000;"><span style="color:#a65700;">&lt;</span><span style="color:#800000;font-weight:bold;">Directory</span> <span style="color:#0000e6;">"/usr/lib/php/pear/symfony_11/data/web/sf/"</span><span style="color:#a65700;">&gt;</span><span style="color:#800000;font-weight:bold;">
  AllowOverride</span> <span style="color:#074726;">All</span>
  <span style="color:#800000;font-weight:bold;">Allow from</span> All<span style="color:#a65700;">
&lt;/</span><span style="color:#800000;font-weight:bold;">Directory</span><span style="color:#a65700;">&gt;</span><span style="color:#a65700;"></span></pre>
<pre style="background:#ffffff none repeat scroll 0 50%;font-size:14px;color:#000000;"><span style="color:#a65700;">&lt;</span><span style="color:#800000;font-weight:bold;">VirtualHost</span> <span style="color:#0000e6;">*:80</span><span style="color:#a65700;">&gt;</span>  <span style="color:#800000;font-weight:bold;">
  ServerName</span> sf11test  <span style="color:#800000;font-weight:bold;">
  DocumentRoot</span> <span style="color:#0000e6;">"/Users/arthur/Webdev/sf11test/web"</span>  <span style="color:#800000;font-weight:bold;">
  DirectoryIndex</span> index.php  

  <span style="color:#800000;font-weight:bold;">Alias</span> /sf /usr/lib/php/pear/symfony_11/data/web/sf/</pre>
<pre style="background:#ffffff none repeat scroll 0 50%;font-size:14px;color:#000000;"><span style="color:#a65700;">  &lt;</span><span style="color:#800000;font-weight:bold;">Directory</span> <span style="color:#0000e6;">"/Users/arthur/Webdev/sf11test/web"</span><span style="color:#a65700;">&gt;</span><span style="color:#800000;font-weight:bold;">
    AllowOverride</span> <span style="color:#074726;">All</span><span style="color:#800000;font-weight:bold;">
    Allow from</span> <span style="color:#074726;">All</span><span style="color:#a65700;">
  &lt;/</span><span style="color:#800000;font-weight:bold;">Directory</span><span style="color:#a65700;">&gt;</span><span style="color:#a65700;">
&lt;/</span><span style="color:#800000;font-weight:bold;">VirtualHost</span><span style="color:#a65700;">&gt;</span></pre>
</div>
<p>Have fun!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/55/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/55/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=55&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/12/22/installing-symfony-11-svn-beside-10-stable/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/12/439196_belong_together.jpg" medium="image">
			<media:title type="html">Symfony 1.0 and 1.1 together! ;-)</media:title>
		</media:content>
	</item>
		<item>
		<title>sfReCaptchaPlugin update to 1.0.2</title>
		<link>http://symfoniac.wordpress.com/2007/10/07/sfrecaptchaplugin-update-to-102/</link>
		<comments>http://symfoniac.wordpress.com/2007/10/07/sfrecaptchaplugin-update-to-102/#comments</comments>
		<pubDate>Sun, 07 Oct 2007 15:46:50 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[captcha]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/10/07/sfrecaptchaplugin-update-to-102/</guid>
		<description><![CDATA[I just released a new version of the sfReCaptchaPlugin.
It updates the recaptcha-php library to version 1.9 (unfortunately there is no changelog available), fixes a problem in the example module where in some cases an error would&#8217;ve been thrown if no text was submitted and updates the documentation.
The most notably change to the recaptcha-php library is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=53&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/10/captchahomepage.gif" alt="captchahomepage.gif" align="right" />I just released a new version of the <a href="http://trac.symfony-project.com/wiki/sfReCaptchaPlugin">sfReCaptchaPlugin</a>.<br />
It updates the recaptcha-php library to version 1.9 (unfortunately there is no changelog available), fixes a problem in the example module where in some cases an error would&#8217;ve been thrown if no text was submitted and updates the documentation.</p>
<p>The most notably change to the recaptcha-php library is that constants are now used instead of globaly declared variables, so that the version included in the plugin doesn&#8217;t need to be modified anymore &#8211; which is great in terms of maintenance.</p>
<p>To upgrade your existing installation, just execute the following command:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;">symfony plugin<span style="color:#808030;">-</span>upgrade http<span style="color:#800080;">:</span><span style="color:#696969;">//plugins.symfony-project.com/sfReCaptchaPlugin</span></pre>
<p>Please go to the <a href="http://trac.symfony-project.com/wiki/sfReCaptchaPlugin">symfony-wiki page</a> for more information.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/53/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/53/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=53&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/10/07/sfrecaptchaplugin-update-to-102/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/10/captchahomepage.gif" medium="image">
			<media:title type="html">captchahomepage.gif</media:title>
		</media:content>
	</item>
		<item>
		<title>Warning about PHP 5.2.4 and Creole</title>
		<link>http://symfoniac.wordpress.com/2007/09/13/warning-about-php-524-and-creole/</link>
		<comments>http://symfoniac.wordpress.com/2007/09/13/warning-about-php-524-and-creole/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 18:06:43 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[bugs]]></category>
		<category><![CDATA[creole]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/09/13/warning-about-php-524-and-creole/</guid>
		<description><![CDATA[It&#8217;s almost half a month ago since PHP 5.2.4 was released and since I really like to update software ;-) I immediately upgraded from 5.2.3 &#8211; but the result was rather shocking &#8211; all my Symfony projects stopped working because of a Exception thrown by Propel: &#8220;Error populating Pages object [wrapped: Unable to convert value [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=50&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/09/154656_stop_sign1.jpg" alt="Warning" align="left" />It&#8217;s almost half a month ago since <a href="http://www.php.net/releases/5_2_4.php">PHP 5.2.4 was released</a> and since I really like to update software ;-) I immediately upgraded from 5.2.3 &#8211; but the result was rather shocking &#8211; all my Symfony projects stopped working because of a Exception thrown by Propel: &#8220;<em>Error populating Pages object [wrapped: Unable to convert value at column 13 to timestamp: 0000-00-00 00:00:00]</em>&#8220;.</p>
<p>I watched the Symfony forums/mailing lists and the Propel mailing lists, but nothing similar was posted so that i tracked it down on my own and found the issue in <a href="http://creole.phpdb.org/trac/">Creole</a> (DBAL used by Propel, which is used by Symfony).</p>
<p>The issue lies in the <em>getTimestamp()</em> function (Line 126 in <em>creole/drivers/mysql/MySQLResultSet.php</em>), which basically just converts a date from your database to a unix timestamp.Let&#8217;s say that your database field has the default value &#8220;0000-00-00 00:00:00&#8243; set on a datetime field and the <em>getTimestamp()</em> function tries to parse this default value with <a href="http://de.php.net/strtotime">strtotime</a>, which worked fine in PHP 5.2.3 and below since this function would return &#8220;943905600&#8243; (which equals to 1999-11-30, but don&#8217;t ask me why&#8230;) <a href="http://bugs.php.net/bug.php?id=41523">but was fixed in PHP 5.2.4</a>. The function now returns boolean <em>FALSE</em> which is causing the function to fail and throw an Exception.</p>
<p>It&#8217;s okay that <em>strtotime</em> doesn&#8217;t accept &#8220;0000-00-00 00:00:00&#8243; as a date and returns false instead, but since this value is often used as a default for a datetime field in Propel and will break your application(s).Unfortunately Creole is not actively maintained anymore, so don&#8217;t expect a fix for this issue, but you can of course fix it yourself like this:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">if</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">fields</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">[</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$column</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">]</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">'0000-00-00 00:00:00'</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">    </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#696969;">// If the value is  '0000-00-00 00:00:00', set it back to the value strtotime() returned before PHP 5.2.4</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">    </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$ts</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">'943916400'</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">else</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">    </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$ts</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#400000;">strtotime</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">fields</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">[</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$column</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">]</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span></pre>
<p>You can try the fix and work with Symfony and PHP 5.2.4, but I will go back to PHP 5.2.3 since i can&#8217;t be 100% sure that there is another error somewhere.Please state your opinion in the comments, thanks!</p>
<p><strong>Update</strong>: Seth Wilson found another instance of this bug in <em>\pear\symfony\vendor\creole\common\ResultSetCommon.php </em>at line 356:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">if</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$ts</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#008c00;">1</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">|</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">|</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$ts</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">false</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#696969;">// in PHP 5.1 return value changes to FALSE</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">throw</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">new</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> SQLException</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">"Unable to convert value at column "</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">.</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$column</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">.</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">" to timestamp: "</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">.</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">fields</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">[</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$idx</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">]</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span></pre>
<p>To fix it, just change it to :</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">if</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$ts</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#008c00;">1</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">|</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">|</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$ts</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">false</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#696969;">// in PHP 5.1 return value changes to FALSE</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">return</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">'943916400'</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#696969;">#throw new SQLException("Unable to convert value at column " . $column . " to timestamp: " . $this-&gt;fields[$idx]);</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span></pre>
<p>Thanks Seth!<span style="font-weight:bold;" class="Apple-style-span"><span style="color:#ff0000;" class="Apple-style-span"></span></span></p>
<p><span style="font-weight:bold;" class="Apple-style-span"><span style="color:#ff0000;" class="Apple-style-span">Update 2:</span></span> Symfony 1.0.9 fixes this problem, be sure to upgrade!</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"></pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/50/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/50/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=50&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/09/13/warning-about-php-524-and-creole/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/09/154656_stop_sign1.jpg" medium="image">
			<media:title type="html">Warning</media:title>
		</media:content>
	</item>
		<item>
		<title>Tschitschereengreen.com re-launched</title>
		<link>http://symfoniac.wordpress.com/2007/08/26/tschitschereengreencom-re-launched/</link>
		<comments>http://symfoniac.wordpress.com/2007/08/26/tschitschereengreencom-re-launched/#comments</comments>
		<pubDate>Sun, 26 Aug 2007 19:42:24 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[german]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[tschitschereengreen]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/08/26/tschitschereengreencom-re-launched/</guid>
		<description><![CDATA[
Today we re-launched Tschitschereengreen.com (where i&#8217;m currently working) with a new web2.0-like design. I did most of the XHTML/CSS stuff and some code fixes.
There&#8217;re still some small bugs, but i hope i can fix them next weekend.
&#160;
Why i&#8217;m writing this here? Because the site runs on symfony ;-)
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=47&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:center;"><img src="http://symfoniac.files.wordpress.com/2007/08/logo1.png" alt="logo1.png" /></p>
<p>Today we re-launched <a href="http://www.tschitschereengreen.com">Tschitschereengreen.com</a> (where i&#8217;m currently working) with a new web2.0-like design. I did most of the XHTML/CSS stuff and some code fixes.<br />
There&#8217;re still some small bugs, but i hope i can fix them next weekend.</p>
<p style="text-align:center;">&nbsp;</p>
<p>Why i&#8217;m writing this here? Because the site runs on symfony ;-)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/47/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/47/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=47&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/08/26/tschitschereengreencom-re-launched/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/08/logo1.png" medium="image">
			<media:title type="html">logo1.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Doktus launched</title>
		<link>http://symfoniac.wordpress.com/2007/08/20/doktus-launched/</link>
		<comments>http://symfoniac.wordpress.com/2007/08/20/doktus-launched/#comments</comments>
		<pubDate>Mon, 20 Aug 2007 18:00:54 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[german]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sphinx]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/08/20/doktus-launched/</guid>
		<description><![CDATA[I&#8217;m currently working in Dresden doing some pretty cool stuff for Tschitschereengreen.
Last Week we launched Doktus &#8211; a document sharing plattform developed with Symfony.
We replaced Zend_Search_Lucene with Sphinx, so that search performance got a huge speedup.
Generally speaking Zend_Search_Lucene isn&#8217;t bad, i had some nice conversations with Alexander Veremyev (Main Developer of ZSL), but the search [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=46&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/08/logo.png" alt="logo.png" align="right" />I&#8217;m currently working in Dresden doing some pretty cool stuff for <a href="http://www.tschitschereengreen.com">Tschitschereengreen</a>.<br />
Last Week we launched <a href="http://www.doktus.de">Doktus</a> &#8211; a document sharing plattform developed with Symfony.</p>
<p>We replaced <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a> with <a href="http://www.sphinxsearch.com/index.html">Sphinx</a>, so that search performance got a huge speedup.<br />
Generally speaking Zend_Search_Lucene isn&#8217;t bad, i had some nice conversations with Alexander Veremyev (Main Developer of ZSL), but the search still has some serious performance issues with indexing and searching large document sets.<br />
Sphinx on the other hand is simply awesome, you might want to take a look at <a href="http://www.sphinxsearch.com/index.html">their website</a> to see all the features. Development is also very active and the upcoming 0.9.8 release looks very promising.</p>
<p>The Flash uploader (which uses <a href="http://linebyline.blogspot.com/">SWFUpload Revision 5</a>) was also quite a bit of work, especially with Flash Player behaving different on Windows/Linux/Mac OS X.<br />
For those people that doesn&#8217;t like Flash (like myself :-P), there&#8217;s a build-in fallback form which still let&#8217;s you upload a document.</p>
<p>What&#8217;s also pretty cool is all the small AJAX stuff we implemented. We&#8217;re using <a href="http://www.prototypejs.org/">Prototype</a> and <a href="http://script.aculo.us/">script.aculo.us</a> since Symfony already provides very useful helpers for this libraries.<br />
Take for example the categories, the pagination or the sorting of documents, everything is AJAXified ;-)</p>
<p>Development is still ongoing so expect some more cool stuff to come.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/46/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/46/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=46&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/08/20/doktus-launched/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/08/logo.png" medium="image">
			<media:title type="html">logo.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting sfFillInFormFilter to output valid xhtml</title>
		<link>http://symfoniac.wordpress.com/2007/08/16/getting-sffillinformfilter-to-output-valid-xhtml/</link>
		<comments>http://symfoniac.wordpress.com/2007/08/16/getting-sffillinformfilter-to-output-valid-xhtml/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 00:22:43 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[bugs]]></category>
		<category><![CDATA[fillin]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/08/16/getting-sffillinformfilter-to-output-valid-xhtml/</guid>
		<description><![CDATA[The sfFillInFilter is really useful for form repopulation and often saves a great deal of time, but if you&#8217;ve worked with it you may also have noticed that, after a form repopulation, all of your xhtml-compliant code is transformed to regular html and thus breaks validation.
I noticed this on a project of mine where some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=44&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/06/thumb_g.thumbnail.png?w=130&#038;h=145" alt="Huh? a bug!" align="right" height="145" width="130" />The sfFillInFilter is really useful for form repopulation and often saves a great deal of time, but if you&#8217;ve worked with it you may also have noticed that, after a form repopulation, all of your xhtml-compliant code is transformed to regular html and thus breaks validation.<br />
I noticed this on a project of mine where some parts of the site would render slightly different after a form repopulation, which caused me to investigate this topic a little bit.<br />
<a href="http://trac.symfony-project.com/trac/ticket/512"><br />
Initially reported for symfony 0.6</a>, it resulted in the <a href="http://trac.symfony-project.com/trac/changeset/2936">addition of the „content_type“ parameter</a> for the 1.0 release. If the parameter passes „xml“, DomDocument in sfFillInFormFilter will load and save XML rather than regular HTML. This seemed to work at first but with some time passed, another serious issue showed up with „xml“ as „content_type“ set. The form repopulation won&#8217;t work <a href="http://trac.symfony-project.com/trac/ticket/1687">because the specified form cannot be found by the sfFillInFormFilter</a>. This issue existed for quite some time.</p>
<p>In April 2007, <a href="http://www.symfony-project.com/forum/index.php/t/6044/"><em>ReeD</em> started a forum thread about this issue</a> and quickly found out that the DOMXPath cannot select elements of an XML document with default namespace defined.<br />
With some help from <em>vanchuck</em> a patch was created and attached to trac, but as of today wasn&#8217;t included in trunk.</p>
<p><strong>Testing</strong></p>
<p>To show you how symfony behaves with and without the patch applied, i performed a small test with a fresh symfony 1.0.6 installation, a simple form with a few input fields and a  small YAML validation file which just enables the sfFillInFormFilter and passes the form name to it:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">fillin</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  enabled</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">true</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  param</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">    </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#400000;">name</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> register</span></pre>
<p>With the form put on a valid xhtml page, repopulated and redisplayed again, all of the self-closing tags like <em>&lt;input &#8230; /&gt;</em> are now converted to it&#8217;s non-selfclosing counterpart.<br />
By adding the „content_type“ parameter and setting it to „xml“:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">fillin</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  enabled</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">true</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  param</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">    </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#400000;">name</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> register</span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">    content_type</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> xml</span></pre>
<p>the output is valid xhtml, but symfony now throws an <em>„No form found in this page“</em> error and the form fields are not repopulated.</p>
<p>With the patch (which is mentioned above) applied to <em>sfFillInForm.class.php</em> and the same validation files as before, it will still needs the „content_type“ parameter set to „xml“. Without the paramter it still won&#8217;t find the form and repopulate it. But if the parameter is passed, sfFillInFormFilter will find your form and finally output valid xhtml!</p>
<p><strong>Summary</strong></p>
<p>To summarize it a little bit, here are three possible solutions that i came up with to get valid xhtml in symfony 1.0:</p>
<ol>
<li>Not using xhtml for your page.</li>
<li>Not using sfFillInFormFilter.</li>
<li>Applying <a href="http://trac.symfony-project.com/trac/ticket/1687">the patch</a> and always setting the „content_type“ parameter to „xml“ in your validation files.</li>
</ol>
<p>Since most of the build-in symfony helpers are using xhtml, it can be quite hard to migrate your code to regular html. You&#8217;ll either have not to use or rewrite them, which can take quite a time.<br />
Not using the sfFillInFormFilter seems nice at first, but can be very time-consuming if you have forms with many fields to repopulate.<br />
By using <a href="http://trac.symfony-project.com/trac/ticket/1687">the patch </a>you&#8217;ll always have to remember to set the „content_type“ parameter to „xml“ in your validation files.</p>
<p>Or maybe just wait for symfony 1.1 with its new and shiny form layer? You decide it! but for now i just hope that i could clear up this topic a little bit.<br />
Please take some time and state your opinion in the comments, thanks!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/44/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/44/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=44&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/08/16/getting-sffillinformfilter-to-output-valid-xhtml/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/06/thumb_g.thumbnail.png" medium="image">
			<media:title type="html">Huh? a bug!</media:title>
		</media:content>
	</item>
		<item>
		<title>CLI Cheat Sheet in German</title>
		<link>http://symfoniac.wordpress.com/2007/06/20/cli-cheat-sheet-in-german/</link>
		<comments>http://symfoniac.wordpress.com/2007/06/20/cli-cheat-sheet-in-german/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 21:47:53 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[cheat-sheet]]></category>
		<category><![CDATA[german]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/06/20/cli-cheat-sheet-in-german/</guid>
		<description><![CDATA[I recently translated Andréia Bohner&#8217;s CLI cheat sheet in german. You can find the JPG and PDF version of the german translation in this post.
Thanks Andréia for creating the cheat sheet in the first place and the kind emails.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=39&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/06/guidebook_translate_books_264580_l.jpg?w=147&#038;h=109" alt="guidebook_translate_books_264580_l.jpg" align="left" height="109" width="147" />I recently translated Andréia Bohner&#8217;s CLI cheat sheet in german. You can find the JPG and PDF version of the german translation <a href="http://andreiabohner.wordpress.com/2007/03/03/symfony-cheat-sheet-estrutura-de-diretorio-e-cli-linha-de-comando/">in this post</a>.</p>
<p>Thanks Andréia for creating the cheat sheet in the first place and the kind emails.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=39&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/06/20/cli-cheat-sheet-in-german/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/06/guidebook_translate_books_264580_l.jpg" medium="image">
			<media:title type="html">guidebook_translate_books_264580_l.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Howto create a counter cache in symfony</title>
		<link>http://symfoniac.wordpress.com/2007/06/08/howto-create-a-counter-cache-in-symfony/</link>
		<comments>http://symfoniac.wordpress.com/2007/06/08/howto-create-a-counter-cache-in-symfony/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 14:37:22 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/06/08/howto-create-a-counter-cache-in-symfony/</guid>
		<description><![CDATA[What&#8217;s a counter cache? I think that the Ruby on Rails wiki explains this best: &#8220;It caches the number of belonging objects on the associated class.&#8220;
Think about something like a weblog with posts and comments. You may want to display the number of comments each post has. Normally you would execute a query to count [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=36&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/06/code.jpg" align="left" />What&#8217;s a <em>counter cache</em>? I think that the <a href="http://wiki.rubyonrails.org/rails/pages/MagicFieldNames">Ruby on Rails wiki</a> explains this best: &#8220;<em>It caches the number of belonging objects on the associated class.</em>&#8220;<br />
Think about something like a weblog with posts and comments. You may want to display the number of comments each post has. Normally you would execute a query to count them, but with a <em>counter cache</em> the <em>post</em> table would have an extra field which updates every time a new comment is created or deleted. This way you save quite a few SQL queries.</p>
<p>While in symfony it isn&#8217;t that simple as in RoR, but it is relatively easy to do. Let&#8217;s take a look at the <em>schama.yml</em> first:</p>
<p style="overflow:auto;">&nbsp;</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="color:#e34adc;">propel:</span>
<span style="color:#e34adc;">  post:</span>
<span style="color:#e34adc;">    id:</span>
<span style="color:#e34adc;">    title:</span> varchar<span style="color:#808030;">(</span><span style="color:#008c00;">255</span><span style="color:#808030;">)</span>
<span style="color:#e34adc;">    body:</span> longvarchar
<span style="color:#e34adc;">    comment_count:</span> integer
<span style="color:#e34adc;">    created_at:</span>

<span style="color:#e34adc;">  comment:</span>
<span style="color:#e34adc;">    id:</span>
<span style="color:#e34adc;">    post_id:</span>
<span style="color:#e34adc;">    body:</span> longvarchar
<span style="color:#e34adc;">    author:</span> varchar<span style="color:#808030;">(</span><span style="color:#008c00;">50</span><span style="color:#808030;">)</span>
<span style="color:#e34adc;">    created_at:</span></pre>
<p>Notice the <em>comment_count</em> field in the <em>post</em> table, which will cache the number of associated comments to each post.<br />
Build the model and open up the <em>lib/model/Comment.php</em> file in your editor. We need to override the <em>save</em> method and make sure that every time a comment is saved, the <em>comment_count</em> field of the associated post is updated:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">public</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">function</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#400000;">save</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$con</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> null</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">if</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">isNew</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">    </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">getPost</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">updateCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">return</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> parent</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">::</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">save</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span></pre>
<p>First we check with the <em>isNew</em> method if a comment really is a new comment because the save method is also used to save an modified object, and then we call the <em>updateCommentCount</em> method of the associated post to update the comment count.</p>
<p>Open the <em>lib/model/Post.php</em> file and create the <em>updateCommentCount</em> method:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">public</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">function</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> updateCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">setCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">getCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">+</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#008c00;">1</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span></pre>
<p>And that&#8217;s it, now everytime a new comment is created, the <em>comment_count</em> field of the associated post is increased by one. You don&#8217;t have to worry about it anymore.</p>
<p>But there is still one thing missing: to decrease the <em>comment_count</em> field of an associated post each time a comment is deleted.</p>
<p>This isn&#8217;t a problem because the basics are the same: override the delete method of the Comment model and modify the <em>updateCommentCount</em> method of the Post model (or create <em>increaseCommentCount</em> / <em>decreaseCommentCount</em> methods if you like that more):</p>
<p>Here&#8217;s a example:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">public</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">function</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#400000;">delete</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$con</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> null</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">getPost</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">updateCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">false</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">return</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> parent</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">::</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">delete</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span></pre>
<p>As you can see i also modified the <em>updateCommentCount</em> method to handle both (in- and decreasing) cases:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">public</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">function</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> updateCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$increase</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">true</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">{</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$count</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">getCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$count</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$increase</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">?</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$count</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">+</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#008c00;">1</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">:</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$count</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#008c00;">1</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">setCommentCount</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$count</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">  </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#400000;">save</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">}</span></pre>
<p>If i pass <strong>true</strong> as a parameter the <em>comment_count</em> field is increased by one and if a pass <strong>false</strong> it decreases the field by one.  (Notice that you have to call the <em>save</em> method when you override the <em>delete</em> method because otherwise it wouldn&#8217;t save the updated count. It wasn&#8217;t necessary in the save method because the it already returned <em>parent::save</em>)</p>
<p>I also recommend watching <a href="http://railscasts.com/episodes/23">this Railscast episode</a> about counter cache, its not PHP but you get the clue.</p>
<p>All comments are appreciated.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=36&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/06/08/howto-create-a-counter-cache-in-symfony/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/06/code.jpg" medium="image" />
	</item>
		<item>
		<title>sfReCaptchaPlugin update to 1.0.1</title>
		<link>http://symfoniac.wordpress.com/2007/06/06/sfrecaptchaplugin-update-to-101/</link>
		<comments>http://symfoniac.wordpress.com/2007/06/06/sfrecaptchaplugin-update-to-101/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 22:10:44 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/06/06/sfrecaptchaplugin-update-to-101/</guid>
		<description><![CDATA[The first update for the sfReCaptchaPlugin is available, which updates the ReCaptcha php-library from version 1.6 to 1.8.
While there doesn&#8217;t seem to be a changelog around, i found the bugs at the mailinglist (here and here):
There was a problem with a variable which holds the url for the SSL authentication server, it was named $recaptcha_api_ssl_server [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=34&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/06/captchahomepage.gif" align="right" />The first update for the <a href="http://trac.symfony-project.com/trac/wiki/sfReCaptchaPlugin">sfReCaptchaPlugin</a> is available, which updates the ReCaptcha php-library from version 1.6 to 1.8.</p>
<p>While there doesn&#8217;t seem to be a changelog around, i found the bugs at the mailinglist (<a href="http://groups.google.com/group/recaptcha/browse_thread/thread/47db783d355da336">here </a>and <a href="http://groups.google.com/group/recaptcha/browse_thread/thread/d2682fa30707c084">here</a>):</p>
<p align="left">There was a problem with a variable which holds the url for the SSL authentication server, it was named <font color="#000080"><strong>$recaptcha_api_ssl_server</strong></font> instead of <font color="#000080"><strong>$recaptcha_api_secure_server</strong></font>.<br />
Both, version 1.7 and 1.8 were adressed to fix this problem.</p>
<p align="left">If you have version 1.0.0 of the plugin installed, you can update it by executing this command in your projects root directory:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;">symfony plugin<span style="color:#808030;">-</span>upgrade http<span style="color:#800080;">:</span><span style="color:#696969;">//plugins.symfony-project.com/sfReCaptchaPlugin</span></pre>
<p align="left">&nbsp;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=34&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/06/06/sfrecaptchaplugin-update-to-101/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/06/captchahomepage.gif" medium="image" />
	</item>
		<item>
		<title>Do we need to validate checkboxes?</title>
		<link>http://symfoniac.wordpress.com/2007/06/06/do-we-need-to-validate-checkboxes/</link>
		<comments>http://symfoniac.wordpress.com/2007/06/06/do-we-need-to-validate-checkboxes/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 18:44:04 +0000</pubDate>
		<dc:creator>Arthur</dc:creator>
				<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://symfoniac.wordpress.com/2007/06/06/do-we-need-to-validate-checkboxes/</guid>
		<description><![CDATA[It&#8217;s common knowledge to never trust any user input and to validate everything. But is this also true for checkboxes? Shouldn&#8217;t Propel handle this properly?
Well, it depends on whether you want to have just zeros and ones in your database field or don&#8217;t care &#8211; because  Propel will write every numeric value in the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=30&subd=symfoniac&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img src="http://symfoniac.files.wordpress.com/2007/06/checkbox_abs.thumbnail.png" alt="checkbox_abs.png" align="right" />It&#8217;s common knowledge to never trust any user input and to validate everything. But is this also true for checkboxes? Shouldn&#8217;t Propel handle this properly?</p>
<p>Well, it depends on whether you want to have just <em>zeros</em> and <em>ones</em> in your database field or don&#8217;t care &#8211; because  Propel will write every numeric value in the database and not just <em>zeros</em> and <em>ones.</em></p>
<h1>Test</h1>
<p>To check this, i used a small example to test if Propel really does save every value of the checkbox in the database:<br />
I created a test module which had a template with a really simple form and just a checkbox:</p>
<p style="overflow:auto;">&nbsp;</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#a65700;">&lt;?php</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">echo</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> form_tag</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">'boolean/index'</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#a65700;">?&gt;</span>
  <span style="background:#ffffe8 none repeat scroll 0 50%;color:#a65700;">&lt;?php</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">echo</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> checkbox_tag</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">'value'</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#a65700;">?&gt;</span>
  <span style="background:#ffffe8 none repeat scroll 0 50%;color:#a65700;">&lt;?php</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">echo</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> submit_tag</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">'submit'</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#a65700;">?&gt;</span>
<span style="color:#a65700;">&lt;/</span><span style="color:#800000;font-weight:bold;">form</span><span style="color:#a65700;">&gt;</span></pre>
<p>To save the value in the database (<strong>Note:</strong> The field was specified as a &#8220;<em>boolean</em>&#8221; in the <em>schema.yml</em>) , a simple action was required:</p>
<pre style="background:#ffffff none repeat scroll 0 50%;color:#000000;"><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$checkbox</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">=</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> </span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">new</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"> Valuetest</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$checkbox</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">setValue</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800000;font-weight:bold;">this</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">getRequestParameter</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#0000e6;">'value'</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;"></span>
<span style="background:#ffffe8 none repeat scroll 0 50%;color:#000000;">$checkbox</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">-</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">&gt;</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#400000;">save</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">(</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#808030;">)</span><span style="background:#ffffe8 none repeat scroll 0 50%;color:#800080;">;</span></pre>
<p>With this, the application saved the value of the checkbox (ideally <em>zero</em> or <em>one</em>) in the <em>&#8220;boolean&#8221;</em> database field (which Propel translates to <em>unsigned integer(11)</em>).</p>
<p>This is where the real test began. What would&#8217;ve happend if the user transformed the checkbox field into a input field? (check out the Webdeveloper firefox extension, it&#8217;s really useful for this kind of tests)</p>
<p>Since the database field was of the integer type it wouldn&#8217;t save values like &#8220;abc&#8221; and instead just saved a <em>zero</em>.<br />
But it turned out that Propel would&#8217;ve saved every other numeric value that will fit in the <em>unsigned integer(11)</em> field (This is a range from <code>-2147483648 to </code><code>2147483647).</code></p>
<p>Here are a few examples which i entered in the datasbase and what Propel returned on a <em>$foobar-&gt;getValue()</em>:</p>
<p>The value <strong>0</strong> returned <strong>false</strong><br />
The value <strong>-9123</strong> returned <strong>true</strong><br />
The value <strong>1</strong> returned <strong>true<br />
</strong> The value <strong>9123</strong> returned <strong>true</strong></p>
<h1>Conclusion</h1>
<p>Your application <u>will not</u> be in danger if you don&#8217;t validate a checkbox field, since Propel will only return <strong><em>true</em></strong> or <strong><em>false</em></strong> for a field that is specified as <em>boolean</em> in the <em>schema.yml</em>.<br />
But your database can be messy and have all kind of numeric values saved in it.</p>
<p>If you&#8217;re like me and just want to have <em>zeroes</em> or <em>ones</em> in your boolean database field, the best thing is to validate the checkbox field using a simple custom validator <a href="http://www.box.net/shared/lkr0s5tk1y">like this simple sfCheckboxValidator i wrote</a>.</p>
<p>Please state your opinion on this topic in the comments, thanks!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/symfoniac.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/symfoniac.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/symfoniac.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/symfoniac.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/symfoniac.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/symfoniac.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/symfoniac.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/symfoniac.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/symfoniac.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/symfoniac.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/symfoniac.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/symfoniac.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=symfoniac.wordpress.com&blog=872897&post=30&subd=symfoniac&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://symfoniac.wordpress.com/2007/06/06/do-we-need-to-validate-checkboxes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c4b28fd28cbf1c3d54fd906ab3af8fe6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">symfoniac</media:title>
		</media:content>

		<media:content url="http://symfoniac.files.wordpress.com/2007/06/checkbox_abs.thumbnail.png" medium="image">
			<media:title type="html">checkbox_abs.png</media:title>
		</media:content>
	</item>
	</channel>
</rss>