<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Snippet: Symfony &amp; Propel &#8211; Queries with SQL functions</title>
	<atom:link href="http://erisds.co.uk/symfony/snippet-symfony-propel-queries-with-sql-functions/feed" rel="self" type="application/rss+xml" />
	<link>http://erisds.co.uk/symfony/snippet-symfony-propel-queries-with-sql-functions</link>
	<description>Web development, Symfony, Wordpress and general geekery</description>
	<lastBuildDate>Mon, 23 Jan 2012 20:31:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Bert-Jan</title>
		<link>http://erisds.co.uk/symfony/snippet-symfony-propel-queries-with-sql-functions/comment-page-1#comment-769</link>
		<dc:creator>Bert-Jan</dc:creator>
		<pubDate>Wed, 28 Jul 2010 06:55:18 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=1498#comment-769</guid>
		<description>You may wish to add to that it&#039;s equivalent for adding custom columns to the SELECTed fields. Here&#039;s what I use to order records that have a date_ontop which is in the future (and therefore relevant) first and all other records after:
[cc lang=&quot;php&quot;]$c-&gt;addAsColumn(&#039;real_datum_ontop&#039;, &#039;IF(&#039;. NewsPeer::DATE_ONTOP .&#039; &gt;= NOW(), &#039;. NewsPeer::DATE_ONTOP .&#039;, NULL)&#039;);
$c-&gt;addDescendingOrderByColumn(&#039;real_datum_ontop&#039;);[/cc]
</description>
		<content:encoded><![CDATA[<p>You may wish to add to that it&#8217;s equivalent for adding custom columns to the SELECTed fields. Here&#8217;s what I use to order records that have a date_ontop which is in the future (and therefore relevant) first and all other records after:</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addAsColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'real_datum_ontop'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IF('</span><span style="color: #339933;">.</span> NewsPeer<span style="color: #339933;">::</span><span style="color: #004000;">DATE_ONTOP</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">' &gt;= NOW(), '</span><span style="color: #339933;">.</span> NewsPeer<span style="color: #339933;">::</span><span style="color: #004000;">DATE_ONTOP</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">', NULL)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addDescendingOrderByColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'real_datum_ontop'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
	</item>
</channel>
</rss>

