<?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: Propel Set Distinct: setDistinct()</title>
	<atom:link href="http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/feed/" rel="self" type="application/rss+xml" />
	<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/</link>
	<description>Development Blog</description>
	<lastBuildDate>Thu, 17 Jun 2010 09:37:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Lawrence Krubner</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-582</link>
		<dc:creator>Lawrence Krubner</dc:creator>
		<pubDate>Thu, 29 Apr 2010 20:56:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-582</guid>
		<description>Yes, still relevant. One of my clients has a 1.0 version Symfony site, which we are adding a few features to.</description>
		<content:encoded><![CDATA[<p>Yes, still relevant. One of my clients has a 1.0 version Symfony site, which we are adding a few features to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Meves</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-581</link>
		<dc:creator>Scott Meves</dc:creator>
		<pubDate>Thu, 29 Apr 2010 17:11:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-581</guid>
		<description>@Lawrence, Thanks! I&#039;m glad it is still relevant.</description>
		<content:encoded><![CDATA[<p>@Lawrence, Thanks! I&#8217;m glad it is still relevant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lawrence Krubner</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-580</link>
		<dc:creator>Lawrence Krubner</dc:creator>
		<pubDate>Thu, 29 Apr 2010 16:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-580</guid>
		<description>Scott, every time I search for anything related to Propel and Symfony, your blog comes up. I think you dug deeper into this material than anyone else.</description>
		<content:encoded><![CDATA[<p>Scott, every time I search for anything related to Propel and Symfony, your blog comes up. I think you dug deeper into this material than anyone else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ouach</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-474</link>
		<dc:creator>Ouach</dc:creator>
		<pubDate>Mon, 24 Aug 2009 13:48:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-474</guid>
		<description>It works for me with :

[...]
while($res = $stmt-&gt;fetchColumn(0)) {
[...]

Please pay attention that if the value of the first element retreaved is NULL (in our example here, if the first cathegory doesn&#039;t have a type), you won&#039;t see the others types at all!
To avoid that, you should add a criteria on Type is not null.</description>
		<content:encoded><![CDATA[<p>It works for me with :</p>
<p>[...]<br />
while($res = $stmt-&gt;fetchColumn(0)) {<br />
[...]</p>
<p>Please pay attention that if the value of the first element retreaved is NULL (in our example here, if the first cathegory doesn&#8217;t have a type), you won&#8217;t see the others types at all!<br />
To avoid that, you should add a criteria on Type is not null.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Meves</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-439</link>
		<dc:creator>Scott Meves</dc:creator>
		<pubDate>Tue, 07 Jul 2009 15:34:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-439</guid>
		<description>@Michael,

I think the setDistinct method still exists in propel 1.3, but the way you retrieve raw results is different. Something like this might work (untested):
&lt;pre lang=&quot;php&quot;&gt;

public static function getTypes() {
  $c = new Criteria();
  $c-&gt;addSelectColumn(CategoryPeer::TYPE);
  $c-&gt;setDistinct();
  $c-&gt;addAscendingOrderByColumn(self::TYPE);
  $stmt = CategoryPeer::doSelectStmt($c);
  
  $types = array();
  while($res = $stmt-&gt;fetchColumn(1)) {
    $types[] = $res;
  }

  return array_combine($types, $types);
}
&lt;/pre&gt;

This propel upgrade page has a lot of good types to help translate old examples. http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/Upgrading</description>
		<content:encoded><![CDATA[<p>@Michael,</p>
<p>I think the setDistinct method still exists in propel 1.3, but the way you retrieve raw results is different. Something like this might work (untested):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span class="kw2">public</span> static <span class="kw2">function</span> getTypes<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  <span class="re0">$c</span> <span class="sy0">=</span> <span class="kw2">new</span> Criteria<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="re0">$c</span><span class="sy0">-&gt;</span><span class="me1">addSelectColumn</span><span class="br0">&#40;</span>CategoryPeer<span class="sy0">::</span><span class="me2">TYPE</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="re0">$c</span><span class="sy0">-&gt;</span><span class="me1">setDistinct</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="re0">$c</span><span class="sy0">-&gt;</span><span class="me1">addAscendingOrderByColumn</span><span class="br0">&#40;</span><span class="kw2">self</span><span class="sy0">::</span><span class="me2">TYPE</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="re0">$stmt</span> <span class="sy0">=</span> CategoryPeer<span class="sy0">::</span><span class="me2">doSelectStmt</span><span class="br0">&#40;</span><span class="re0">$c</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
  <span class="re0">$types</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="kw1">while</span><span class="br0">&#40;</span><span class="re0">$res</span> <span class="sy0">=</span> <span class="re0">$stmt</span><span class="sy0">-&gt;</span><span class="me1">fetchColumn</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="re0">$types</span><span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re0">$res</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
&nbsp;
  <span class="kw1">return</span> <span class="kw3">array_combine</span><span class="br0">&#40;</span><span class="re0">$types</span><span class="sy0">,</span> <span class="re0">$types</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>

<p>This propel upgrade page has a lot of good types to help translate old examples. <a href="http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/Upgrading" rel="nofollow">http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/Upgrading</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-436</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 07 Jul 2009 08:56:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-436</guid>
		<description>Hi,
I tried your tips but it doesn&#039;t work for me.
Assume that it&#039;because I&#039;m  using symfony 1.27 and propel1.3.
Any idea, please?
thanks</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I tried your tips but it doesn&#8217;t work for me.<br />
Assume that it&#8217;because I&#8217;m  using symfony 1.27 and propel1.3.<br />
Any idea, please?<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Meves</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-433</link>
		<dc:creator>Scott Meves</dc:creator>
		<pubDate>Fri, 03 Jul 2009 02:17:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-433</guid>
		<description>@Jack, self:: would work just fine! BasePeer is the &quot;base&quot; class that all of the other propel __Peer classes descend from. So if you called &quot;self::doSelect&quot;, it actually is calling the doSelect() method in the BasePeer class, unless you decide to override the method in your child class. I chose BasePeer just to be explicit where the method was defined, but &quot;self&quot; would more extendible in case you wanted to make local modifications.</description>
		<content:encoded><![CDATA[<p>@Jack, self:: would work just fine! BasePeer is the &#8220;base&#8221; class that all of the other propel __Peer classes descend from. So if you called &#8220;self::doSelect&#8221;, it actually is calling the doSelect() method in the BasePeer class, unless you decide to override the method in your child class. I chose BasePeer just to be explicit where the method was defined, but &#8220;self&#8221; would more extendible in case you wanted to make local modifications.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-432</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Thu, 02 Jul 2009 23:37:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-432</guid>
		<description>Great post, thanks a ton.  Quick question: for the line &quot;$rs = BasePeer::doSelect($c);&quot; why do you use &quot;BasePeer&quot;, rather than &quot;self&quot;.  Why wouldn&#039;t self work?  And what is this BasePeer?

Thanks again.</description>
		<content:encoded><![CDATA[<p>Great post, thanks a ton.  Quick question: for the line &#8220;$rs = BasePeer::doSelect($c);&#8221; why do you use &#8220;BasePeer&#8221;, rather than &#8220;self&#8221;.  Why wouldn&#8217;t self work?  And what is this BasePeer?</p>
<p>Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Meves</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-365</link>
		<dc:creator>Scott Meves</dc:creator>
		<pubDate>Sun, 08 Feb 2009 22:29:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-365</guid>
		<description>Vitriolix — You&#039;re very welcome! Glad it helps someone else out there too. If you run into any other propel issues that you think might be useful for a post let me know. There aren&#039;t too many good resources out there so we have to make our own. Also, if you are working with the latest version of symfony and you find that some of the posts need updating for the new version, leave a note!</description>
		<content:encoded><![CDATA[<p>Vitriolix — You&#8217;re very welcome! Glad it helps someone else out there too. If you run into any other propel issues that you think might be useful for a post let me know. There aren&#8217;t too many good resources out there so we have to make our own. Also, if you are working with the latest version of symfony and you find that some of the posts need updating for the new version, leave a note!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vitriolix</title>
		<link>http://stereointeractive.com/blog/2007/12/13/propel-set-distinct-setdistinct/comment-page-1/#comment-364</link>
		<dc:creator>vitriolix</dc:creator>
		<pubDate>Sun, 08 Feb 2009 20:31:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stereodevelopment.com/2007/12/13/propel-set-distinct-setdistinct/#comment-364</guid>
		<description>Thanks very much for these blog posts, several time&#039;s I&#039;ve ended up here from my googling for ideas when I get stuck trying to do some advanced stuff with propel.</description>
		<content:encoded><![CDATA[<p>Thanks very much for these blog posts, several time&#8217;s I&#8217;ve ended up here from my googling for ideas when I get stuck trying to do some advanced stuff with propel.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
