<?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: Etwas untergegangen: Propel 1.4 is raus	</title>
	<atom:link href="https://nerdpress.org/2009/11/12/etwas-untergegangen-propel-1-4-is-raus/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org/2009/11/12/etwas-untergegangen-propel-1-4-is-raus/</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Fri, 13 Nov 2009 12:24:44 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		By: Max Girkens		</title>
		<link>https://nerdpress.org/2009/11/12/etwas-untergegangen-propel-1-4-is-raus/#comment-62</link>

		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Fri, 13 Nov 2009 12:24:44 +0000</pubDate>
		<guid isPermaLink="false">https://nerdpress.org/?p=576#comment-62</guid>

					<description><![CDATA[glaub&#039; das ist auch mal ein echter Gewinn:
das ging nämlich immer ordentlich auf die Performance...

Foreign Key Retrievers Now Use Instance Pool

When you retrieve an object related to the current model object by a foreign key, you usually use a method generated by Propel, as follows:

[sourcecode lang=&quot;php&quot;]
$author = $book-&gt;getAuthor(); // $author is an Author instance
[/sourcecode]

Behind the curtain, this method uses the author_id property of the current book object, makes a query to the database for the related author record, and hydrates an Author object with the result. But what if you already have hydrated this author object earlier in the script? Thanks to instance pooling, Propel remembers the objects it has in memory, which can save a lot of database queries. For instance:

[sourcecode lang=&quot;php&quot;]
foreach($author-&gt;getBooks() as $book)
{
        echo $book-&gt;getTitle();
  echo $book-&gt;getAuthor()-&gt;getName();
}
[/sourcecode]

In Propel 1.3, this code would issue n+1 queries to the database (n being the number of books written by $author). But with Propel 1.4, this code only executes one query. As the getAuthor() method is called, Propel knows that the author of each book is already in memory, and therefore skips the database query and the hydration process altogether. hte result is a slight speed boost, and a decrease in the number of queries executed per page.]]></description>
			<content:encoded><![CDATA[<p>glaub&#8217; das ist auch mal ein echter Gewinn:<br />
das ging nämlich immer ordentlich auf die Performance&#8230;</p>
<p>Foreign Key Retrievers Now Use Instance Pool</p>
<p>When you retrieve an object related to the current model object by a foreign key, you usually use a method generated by Propel, as follows:</p>
<pre class="brush: php; title: ; notranslate">
$author = $book-&gt;getAuthor(); // $author is an Author instance
</pre>
<p>Behind the curtain, this method uses the author_id property of the current book object, makes a query to the database for the related author record, and hydrates an Author object with the result. But what if you already have hydrated this author object earlier in the script? Thanks to instance pooling, Propel remembers the objects it has in memory, which can save a lot of database queries. For instance:</p>
<pre class="brush: php; title: ; notranslate">
foreach($author-&gt;getBooks() as $book)
{
        echo $book-&gt;getTitle();
  echo $book-&gt;getAuthor()-&gt;getName();
}
</pre>
<p>In Propel 1.3, this code would issue n+1 queries to the database (n being the number of books written by $author). But with Propel 1.4, this code only executes one query. As the getAuthor() method is called, Propel knows that the author of each book is already in memory, and therefore skips the database query and the hydration process altogether. hte result is a slight speed boost, and a decrease in the number of queries executed per page.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
