<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TYPO3Development &#187; extension development</title>
	<atom:link href="http://blog.typoplanet.de/tag/extension-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.typoplanet.de</link>
	<description>A blog for professional TYPO3 developers</description>
	<lastBuildDate>Mon, 28 Mar 2011 18:10:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Query the Linked Data Cloud using TYPO3</title>
		<link>http://blog.typoplanet.de/2011/03/28/query-linked-data-cloud-typo3/</link>
		<comments>http://blog.typoplanet.de/2011/03/28/query-linked-data-cloud-typo3/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 18:10:02 +0000</pubDate>
		<dc:creator>Jochen Rau</dc:creator>
				<category><![CDATA[Semantic Web integration]]></category>
		<category><![CDATA[extension development]]></category>
		<category><![CDATA[rdf]]></category>
		<category><![CDATA[semantic web]]></category>
		<category><![CDATA[sparql]]></category>

		<guid isPermaLink="false">http://blog.typoplanet.de/?p=397</guid>
		<description><![CDATA[The Semantic Web is coming to a TYPO3 installation near you. During the TYPO3 Transition Days 2011 in Berlin a couple of Developers&#8212;including me&#8212;discussed about how to implement some aspects of the Semantic Web Stack for TYPO3. One of the first outcome is the new Extension &#8220;semantic&#8221; providing a SPARQL Client. You can query the [...]]]></description>
			<content:encoded><![CDATA[<p>The Semantic Web is coming to a <a href="http://typo3.org">TYPO3</a> installation near you. During the TYPO3 Transition Days 2011 in Berlin a couple of Developers&mdash;including me&mdash;discussed about how to implement some aspects of the Semantic Web Stack for TYPO3. One of the first outcome is the new <a href="http://forge.typo3.org/projects/show/extension-semantic">Extension &#8220;semantic&#8221;</a> providing a SPARQL Client.<br />
<span id="more-397"></span></p>
<p>You can query the <a href="http://linkeddata.org">Linked Data Cloud</a>&mdash;which includes the content of Wikipedia&mdash;by specifying a Query in the <a href="http://en.wikipedia.org/wiki/SPARQL">SPARQL Protocol and RDF Query Language</a>. For example, the statement to query for <em>People born in Boston before 1900</em> looks like:</p>
<div class="codecolorer-container mysql dawn" 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 />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">PREFIX foaf: <span style="color: #CC0099;">&lt;</span>http: <span style="color: #CC0099;">//</span>xmlns.com<span style="color: #CC0099;">/</span>foaf<span style="color: #CC0099;">/</span><span style="color: #008080;">0.1</span><span style="color: #CC0099;">/&gt;</span><br />
PREFIX dbr: <span style="color: #CC0099;">&lt;</span>http: <span style="color: #CC0099;">//</span>dbpedia.org<span style="color: #CC0099;">/</span>resource<span style="color: #CC0099;">/&gt;</span><br />
PREFIX dbo: <span style="color: #CC0099;">&lt;</span>http: <span style="color: #CC0099;">//</span>dbpedia.org<span style="color: #CC0099;">/</span>ontology<span style="color: #CC0099;">/&gt;</span><br />
PREFIX xsd: <span style="color: #CC0099;">&lt;</span>http: <span style="color: #CC0099;">//</span>www.w3.org<span style="color: #CC0099;">/</span><span style="color: #008080;">2001</span><span style="color: #CC0099;">/</span>XMLSchema<span style="color: #808080; font-style: italic;">#&gt;</span><br />
<br />
<span style="color: #990099; font-weight: bold;">SELECT</span> ?resource ?name ?birthDate ?deathDate<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #FF00FF;">&#123;</span><br />
&nbsp; ?resource a foaf:Person .<br />
&nbsp; ?resource foaf:name ?name .<br />
&nbsp; ?resource dbo:birthPlace dbr:Boston .<br />
&nbsp; ?resource dbo:birthDate ?birthDate .<br />
&nbsp; ?resource dbo:deathDate ?deathDate .<br />
&nbsp; FILTER <span style="color: #FF00FF;">&#40;</span>?birthDate <span style="color: #CC0099;">&lt;</span> <span style="color: #008000;">&quot;1900-01-01&quot;</span><span style="color: #CC0099;">^^</span>xsd:<span style="color: #999900; font-weight: bold;">date</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #FF00FF;">&#125;</span><br />
<span style="color: #990099; font-weight: bold;">ORDER BY</span> ?deathDate</div></td></tr></tbody></table></div>
<p>In the following video I will guide you through the installation of the Extension &#8220;semantic&#8221; and demo some of its features.</p>
<p><object width="604" height="364">
	<param name="movie" value="http://www.youtube.com/v/Kz_8RozC5eM?fs=1&amp;hl=en_US"></param>
	<param name="allowFullScreen" value="true"></param>
	<param name="allowscriptaccess" value="always"></param>
	<embed src="http://www.youtube.com/v/Kz_8RozC5eM?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="604" height="364"></embed>
</object></p>
<p>I have also recorded the first fifteen minutes in the life of the extension. In the following video you see how I kickstarted the extension. Keep in mind that the library ARC2 I used in this first step isn&#8217;t part of the extension anymore. All the code is now written from scratch, including the SPARQL Query Parser (see other posting).</p>
<p><object width="604" height="364">
	<param name="movie" value="http://www.youtube.com/v/w12fudccROs?fs=1&amp;hl=en_US"></param>
	<param name="allowFullScreen" value="true"></param>
	<param name="allowscriptaccess" value="always"></param>
	<embed src="http://www.youtube.com/v/w12fudccROs?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="604" height="364"></embed>
</object></p>
<p>If you have any specific questions about the extension or found an issue, please visit the projects page on Forge so we can keep track of it. You might also want to have a look at our roadmap or visit the Homepage of the <a href="http://www.typo3.org">TYPO3 community.</http:></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.typoplanet.de/2011/03/28/query-linked-data-cloud-typo3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to Effectively use the Repository and Query Object of Extbase?</title>
		<link>http://blog.typoplanet.de/2010/01/27/the-repository-and-query-object-of-extbase/</link>
		<comments>http://blog.typoplanet.de/2010/01/27/the-repository-and-query-object-of-extbase/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 17:13:32 +0000</pubDate>
		<dc:creator>Jochen Rau</dc:creator>
				<category><![CDATA[Extbase]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[extension development]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[query object]]></category>
		<category><![CDATA[repository]]></category>

		<guid isPermaLink="false">http://blog.typoplanet.de/?p=327</guid>
		<description><![CDATA[Extbase supports very well the idea of Domain-Driven Design. It supplies a Repository class to comfortably fetch your objects from. Some handy methods are already implemented. Let&#8217;s have a look at some example code. 12345678910111213141516171819202122$blog = new Tx_BlogExample_Domain_Model_Blog&#40;'TYPO3 Development'&#41;; $blog-&#62;setDescription&#40;'A blog for professional TYPO3 developers.'&#41;; $administrator = new Tx_BlogExample_Domain_Model_Administrator&#40;&#41;; $administrator-&#62;setName&#40;'Jochen Rau'&#41;; $administrator-&#62;setEmail&#40;'jochen.rau@example.com'&#41;; $blog-&#62;setAdministrator&#40;$administrator&#41;; $post = [...]]]></description>
			<content:encoded><![CDATA[<p>Extbase supports very well the idea of Domain-Driven Design. It supplies a <code class="codecolorer php dawn"><span class="php">Repository</span></code> class to comfortably fetch your objects from. Some handy methods are already implemented. <span id="more-327"></span> Let&#8217;s have a look at some example code.</p>
<div class="codecolorer-container php dawn" 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 />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<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;">$blog</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Tx_BlogExample_Domain_Model_Blog<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TYPO3 Development'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDescription</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'A blog for professional TYPO3 developers.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$administrator</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Tx_BlogExample_Domain_Model_Administrator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$administrator</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Jochen Rau'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$administrator</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setEmail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jochen.rau@example.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAdministrator</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$administrator</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Tx_BlogExample_Domain_Model_Post<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Effectively use the Query Object of Extbase'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setContent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Extbase is a framework to develop ... hey, we\'re getting recursive now!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$comment</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Tx_BlogExample_Domain_Model_Comment<span style="color: #339933;">;</span><br />
<span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDate</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> DateTime<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAuthor</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Peter Pan'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setEmail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'peter.pan@example.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setContent</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Do you need some pills?.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addComment</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$blog</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addPost</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$blogRepository</span> <span style="color: #339933;">=</span> t3lib_div<span style="color: #339933;">::</span><span style="color: #004000;">makeInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tx_BlogExample_Domain_Repository_BlogRepository'</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$blogRepository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$blog</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>In a first step, we create a new blog with an administrator, and a post with a comment. We instanciate the <code class="codecolorer php dawn"><span class="php">BlogRepository</span></code> in line 21 and add the blog to it. That&#8217;s all we have to do. The blog is now persisted and can be fetched later from the repository again. We don&#8217;t have to say <code class="codecolorer php dawn"><span class="php">save<span style="color: #009900;">&#40;</span><span style="color: #000088;">$blog</span><span style="color: #009900;">&#41;</span></span></code> at any time. The repository &#8220;takes care&#8221; of the blog.</p>
<p>Keep in mind that you have to instanciate the repository with <code class="codecolorer php dawn"><span class="php">t3lib_div<span style="color: #339933;">::</span><span style="color: #004000;">makeInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> as it is a Singleton. If you instanciate it with <code class="codecolorer php dawn"><span class="php"><span style="color: #000000; font-weight: bold;">new</span></span></code> the Repository will be always an empty one if Extbase searches for objects to be persisted.</p>
<p>The <code class="codecolorer php dawn"><span class="php">BlogRepository</span></code> class is as simple as this:</p>
<div class="codecolorer-container php dawn" 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 />3<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: #000000; font-weight: bold;">class</span> Tx_BlogExample_Domain_Repository_BlogRepository <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">extends</span> Tx_Extbase_Persistence_Repository <span style="color: #009900;">&#123;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Most of the methods needed are already implemented in the <code class="codecolorer php dawn"><span class="php">Tx_Extbase_Persistence_Repository</span></code>. These are:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$object</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$object</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$existingObject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newObject</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$modifiedObject</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">countAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// Since Extbase 1.1</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">removeAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">countByProperty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// Since Extbase 1.1</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findByProperty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000088;">$repository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findOneByProperty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span></div></div>
<p>The methods <code class="codecolorer php dawn"><span class="php">add<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> and <code class="codecolorer php dawn"><span class="php">remove<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> are self-explanatory. <code class="codecolorer php dawn"><span class="php">replace<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> takes an untracked object and puts it at the &#8220;place&#8221; of an existing one where <code class="codecolorer php dawn"><span class="php">update<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> just takes an existing object and updates it with the property values of the modified object.</p>
<p>The <code class="codecolorer php dawn"><span class="php">findByProperty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> and <code class="codecolorer php dawn"><span class="php">findOneByProperty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> methods are magic methods where you can replace &#8220;Property&#8221; with the name of a property of the <code class="codecolorer php dawn"><span class="php">Blog</span></code> object. For example we can write <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$blogRepository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findByTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'My Blog'</span><span style="color: #009900;">&#41;</span></span></code> to fetch all Blogs with the given title. This also works for objects like in <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$blogRepository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findByAdministrator</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$administrator</span><span style="color: #009900;">&#41;</span></span></code> but not yet for properties holding aggregates. Thus, <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$blogRepository</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findByPost</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span></span></code> won&#8217;t work by now. <code class="codecolorer php dawn"><span class="php">findOneByProperty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> is pretty similar to <code class="codecolorer php dawn"><span class="php">findByProperty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> but returns the only first Object found.</p>
<p>The <code class="codecolorer php dawn"><span class="php">countAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> and <code class="codecolorer php dawn"><span class="php">countByProperty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> methods are similar to the according <code class="codecolorer php dawn"><span class="php">find</span></code> methods. But the don&#8217;t build objects. They only count resulting objects.</p>
<p>All these methods keep the underlying storage solution (mostly a relational database) transparent to the user. But what if we have special constraints that are not covered with the methods above? Let&#8217;s say we want to find the five most recent posts of a given blog. Then we can use a <code class="codecolorer php dawn"><span class="php">Query</span></code> object.  Let&#8217;s ask the <code class="codecolorer php dawn"><span class="php">PostRepository</span></code> for those posts:</p>
<div class="codecolorer-container php dawn" 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 />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<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: #000000; font-weight: bold;">class</span> Tx_BlogExample_Domain_Repository_PostRepository<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">extends</span> Tx_Extbase_Persistence_Repository <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> findRecentByBlog<span style="color: #009900;">&#40;</span>Tx_BlogExample_Domain_Model_Blog <span style="color: #000088;">$blog</span><span style="color: #339933;">,</span> <span style="color: #000088;">$limit</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">matching</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'blog'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$blog</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOrderings</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'date'</span> <span style="color: #339933;">=&gt;</span> Tx_Extbase_Persistence_QueryInterface<span style="color: #339933;">::</span><span style="color: #004000;">ORDER_DESCENDING</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLimit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>integer<span style="color: #009900;">&#41;</span><span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$posts</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$posts</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The method <code class="codecolorer php dawn"><span class="php">createQuery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> returns an appropriate <code class="codecolorer php dawn"><span class="php">Query</span></code> object suitable for <code class="codecolorer php dawn"><span class="php">Post</span></code> objects. In Line 6 we define the constraint the posts should match: <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">matching</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>constraint<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span></span></code>. The constraint is returned by <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'blog'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$blog</span><span style="color: #009900;">&#41;</span></span></code>. There are some more methods returning a constraint:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">logicalAnd</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$constraint1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$constraint2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">logicalOr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$constraint1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$constraint2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">logicalNot</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$constraint</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">withUid</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #339933;">,</span> <span style="color: #000088;">$caseSensitive</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">in</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Since Extbase 1.1</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Since Extbase 1.1</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">like</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lessThan</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lessThanOrEqual</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greaterThan</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">greaterThanOrEqual</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$propertyName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>We can define the orderings with <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOrderings</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>orderings<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span></span></code> where <code class="codecolorer php dawn"><span class="php"><span style="color: #009900;">&#91;</span>orderings<span style="color: #009900;">&#93;</span></span></code> is expected to be an array of property-order pairs. There are two constants defining the order:</p>
<ul>
<li>Order ascending: <code class="codecolorer php dawn"><span class="php">Tx_Extbase_Persistence_QueryInterface<span style="color: #339933;">::</span><span style="color: #004000;">ORDER_ASCENDING</span></span></code></li>
<li>Order descending: <code class="codecolorer php dawn"><span class="php">Tx_Extbase_Persistence_QueryInterface<span style="color: #339933;">::</span><span style="color: #004000;">ORDER_DESCENDING</span></span></code></li>
</ul>
<p>We limit the result set to a maximum of five posts with <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLimit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>integer<span style="color: #009900;">&#41;</span><span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span></span></code>. And finally invoke <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> which returns us the already build posts with all their comments inside (if we are not &#8220;lazy&#8221; ;-) ). There is also a method <code class="codecolorer php dawn"><span class="php"><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></span></code> which does  not fetch the resulting posts but counts them. Note that the <code class="codecolorer php dawn"><span class="php">Query</span></code> object enables chaining. Thus, the following code does the same as the given above:</p>
<div class="codecolorer-container php dawn" 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 />3<br />4<br />5<br />6<br />7<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: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> findRecentByBlog<span style="color: #009900;">&#40;</span>Tx_BlogExample_Domain_Model_Blog <span style="color: #000088;">$blog</span><span style="color: #339933;">,</span> <span style="color: #000088;">$limit</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">matching</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'blog'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$blog</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOrderings</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'date'</span> <span style="color: #339933;">=&gt;</span> Tx_Extbase_Persistence_QueryInterface<span style="color: #339933;">::</span><span style="color: #004000;">ORDER_DESCENDING</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLimit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>integer<span style="color: #009900;">&#41;</span><span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>That&#8217;s it for today. I hope you got a deeper insight and I am looking forward to your comments. Maybe you want to join the discussion on the related <a href="http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc">mailing list</a>. I have taken most of the code from the extension <code class="codecolorer php dawn"><span class="php">BlogExample</span></code> which is available in the <a href="http://typo3.org/extensions/repository/view/blog_example/current/">Extension Repository (TER)</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.typoplanet.de/2010/01/27/the-repository-and-query-object-of-extbase/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>A walk through the persistence layer of Extbase</title>
		<link>http://blog.typoplanet.de/2009/07/16/a-walk-trough-the-persistence-layer-of-extbase/</link>
		<comments>http://blog.typoplanet.de/2009/07/16/a-walk-trough-the-persistence-layer-of-extbase/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 09:34:16 +0000</pubDate>
		<dc:creator>Jochen Rau</dc:creator>
				<category><![CDATA[Extbase]]></category>
		<category><![CDATA[extension development]]></category>
		<category><![CDATA[flow3]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://blog.typoplanet.de/?p=275</guid>
		<description><![CDATA[Extbase is the new frame-work for TYPO3 extension developers introduced in TYPO3 v4.3. In this article I will give you a brief overview over the persistence layer of Extbase. It falls into different (sub)layers — each of the with different responsibilities. Let&#8217;s start our journey from the top level. 1. Repository A Repository is the first [...]]]></description>
			<content:encoded><![CDATA[<p>Extbase is the new frame-work for <a title="TYPO3 project page" href="http://www.typo3.org">TYPO3</a> extension developers introduced in TYPO3 v4.3. In this article I will give you a brief overview over the persistence layer of Extbase. It falls into different (sub)layers — each of the with different responsibilities. Let&#8217;s start our journey from the top level.<span id="more-275"></span></p>
<p><strong>1. Repository</strong></p>
<p>A Repository is the first objects a developer comes in contact to. It handles only domain objects and provide task oriented interface to retrieve them by saying findByFoo(&#8216;Bar&#8217;). Most of the time you are done.</p>
<p><strong>2. Query</strong></p>
<p>The next level is the Query object. It provides methods to create an abstract query (abstract in sense of abstracted from where the objects come from). It has no clue about the underlying structure of the storage. It even does not now if it is based on a relational model or a tree model (like the content repository of [FLOW3|FLOW3 is a next generation web application framework built for the upcoming TYPO3 v5]). It also invokes the DataMapper (see below). An extension developer uses the Query object to create his own findByFoo() methods for  his Repositories.</p>
<p><strong>3. QueryObjectModel</strong></p>
<p>Deeper and deeper we dig &#8230; In comparison to the Query object Query Object Model knows about the underlying concepts of relations and thus Joins and Orderings. An extension developer may use this class to specify more complex and &#8220;relational model&#8221; aware queries. That makes the creation of queries (esp. Joins) al little bit laborious. But it helps to keep abstraction.</p>
<p><strong>4. StorageBackend</strong></p>
<p>The Storage Backend translates the Query Object Model in syntactical correct statement (SQL). It also invokes the call to the database via a handler. An extension developer normally does not have to mak his hands dirty with SQL (which is in most cases the best way to improve performance and security).</p>
<p><strong>5. DatabaseHandler</strong></p>
<p>The Database Handler prepares queries, fetches the result set. It can be simply the [t3lib_db|A class in TYPO3 providing methods to access a database], or [PDO|PHP Data Objects], or your preferred solution.</p>
<p><strong>6. DataMapper</strong></p>
<p>And finally the Data Mapper. It maps the resulting rows on the Domain Object (it creates an empty object and fills it with the converted property values). It also resolves relations according to the loading strategy (eg. Lazy Loading Proxy).</p>
<p>Puh! Now we are done. Hope you enjoyed the journey.</p>
<p><strong>F.A.Q</strong></p>
<p><strong>Q</strong> Are you nuts! Six different layers, dozens of objects, and bunch of new things to learn! I only wanted to say &#8220;SELECT * FROM Tx_MyExt_Foo WHERE &#8230;&#8221;!<br />
<strong>A</strong> You are right: I am nuts (at least a litte bit ;-)). But now we are fully compatible to the (Query) API of FLOW3 and reached the best level to port Extensions forward. And I really like the Idea of having totally freedom of choice.</p>
<p><strong>Q</strong> And what about performance?<br />
<strong>A</strong> That’s indeed a very important point. We will do some extensive profiling sessions, implement Lazy Loading strategies, and strive for optimized Queries.</p>
<p>And please keep in mind: 90% of the work is based on the concepts and code of <a title="FLOW3 project page" href="http://flow3.typo3.org/">FLOW3</a>. Credits goes to the FLOW3 team.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.typoplanet.de/2009/07/16/a-walk-trough-the-persistence-layer-of-extbase/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TYPO3 v5—The mental Transition</title>
		<link>http://blog.typoplanet.de/2009/03/30/typo3-v5%e2%80%94the-mental-transition/</link>
		<comments>http://blog.typoplanet.de/2009/03/30/typo3-v5%e2%80%94the-mental-transition/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 15:19:00 +0000</pubDate>
		<dc:creator>Jochen Rau</dc:creator>
				<category><![CDATA[Development Process]]></category>
		<category><![CDATA[extension development]]></category>
		<category><![CDATA[flow3]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[typo3 v5]]></category>

		<guid isPermaLink="false">http://blog.typoplanet.de/?p=213</guid>
		<description><![CDATA[The upcoming Version 5 of TYPO3 is rewritten from scratch. It is based on a new framework called FLOW3. With TYPO3 v5 the [API&#124;Application Programming Interface] will change completely. There are also a couple of new programming paradigms and patterns. Personally, I am very enthusiastic about the &#8220;new way&#8221;. The past couple of months I had [...]]]></description>
			<content:encoded><![CDATA[<p>The upcoming <a title="Roadmap of TYPO3" href="http://typo3.org/development/roadmap/">Version 5 of TYPO3</a> is rewritten from scratch. It is based on a new framework called <a title="Link to FLOW3" href="http://flow3.typo3.org/">FLOW3</a>. With TYPO3 v5 the [API|Application Programming Interface] will change completely. There are also a couple of new programming paradigms and patterns. Personally, I am very enthusiastic about the &#8220;new way&#8221;.</p>
<p>The past couple of months I had numerous discussions about the new version and how to migrate from TYPO3 v4 to v5. And I had to realize that there are several reservations and concerns about all the new things to learn. All of them have to be taken into account to keep the community healthy.<br />
<span id="more-213"></span></p>
<p>The people I have talked with had different backgrounds (different knowledge about TYPO3, different involvement in the community, etc.). Most of them asked one of the following questions:</p>
<ol>
<li>When will TYPO3 v5 be available?</li>
<li>How to migrate content?</li>
<li>How to migrate code (extensions)?</li>
<li>How to migrate me?</li>
</ol>
<p>Questions 1.-3. are already covered by <a title="FAQ about FLOW3" href="http://flow3.typo3.org/about/faq/">an article of the v5 team</a>. The most underestimated question is, how to cope with the mental transition of the developers. Many developers pointed out that they do not have enough time to dig into the new version. Maybe that is a question of how to weight the time spent on daily business and the time spent on (self) education. This prioritization has to be done not only by the developer himself but also by the company he is working for. Therefore, many of the developers decided to wait until FLOW3/TYPO3 v5 is released at a future point in time.</p>
<p>To enable the developers to get in touch with the paradigms of FLOW3 as soon as possible was my personal motivation to be involved in doing a back-port of the  FLOW3 [MVC|MVC stands for Model-View-Controller, a way to separate different concerns of an application] frame-work. The result is <a href="http://forge.typo3.org/projects/show/typo3v4-mvc">ExtBase</a>, a new frame-work for extensions and a successor of [pi_Base|The standard Plugin Base Class of TYPO3 v4]. It will be shipped with TYPO3 v4.3. It is planned to be released in May, 2009.</p>
<p>Furthermore, I am very happy about the decision at the TYPO3 snowboard tour to back-port Fluid, too. Fluid is a very sophisticated new templating engine mainly developed by <a href="http://sandstorm-media.de/about-us.html">Sebastian Kurfürst</a>.</p>
<p>ExtBase in companion with Fluid encourages the developer of TYPO3 v4 based extensions to code the FLOW3 style right now.  There is already an example extension called BlogExample available. At time of the release of v4.3 we also plan to give a good documentation at hand.</p>
<p>Although we implemented already 80% of the features there is quite a lot of work to do (e.g. implementing view helper classes, doing code reviews, and integration testing, writing documentation and tutorials). Do not hesitate to send me a message, if you want to lend us a helping hand.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.typoplanet.de/2009/03/30/typo3-v5%e2%80%94the-mental-transition/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Domain Driven Content Management</title>
		<link>http://blog.typoplanet.de/2009/03/07/domain-driven-content-management/</link>
		<comments>http://blog.typoplanet.de/2009/03/07/domain-driven-content-management/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 12:02:31 +0000</pubDate>
		<dc:creator>Jochen Rau</dc:creator>
				<category><![CDATA[Development Process]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[extension development]]></category>

		<guid isPermaLink="false">http://blog.typoplanet.de/?p=74</guid>
		<description><![CDATA[This Article is about the Domain of a Content Management System. What is the content all about? How is it structured, oredere, classified? How can it be transformed form one presentation form to another? And how can we deal with content in TYPO3 v5.x?]]></description>
			<content:encoded><![CDATA[<p>Domain Driven Design is—by experience—a strong concept and a good foundation to build TYPO3 extensions upon.</p>
<blockquote><p><strong>Domain-driven design</strong> (DDD) is an approach to the design of software, based on the two premises that complex domain designs should be based on a model, and that, for most software projects, the primary focus should be on the domain and domain logic [...].</p></blockquote>
<p>The domain represents structure, knowledge and data. A content management system (CMS) like TYPO3 has to handle the data of the domain with respect to the domain knowledge. It aggregates the data, and visualizes it as a content of an output format.</p>
<p>A question emerges: How should the data stored in a domain be mapped on the content of the output? <span id="more-74"></span>You might say: &#8220;Hey, what&#8217;s the problem? The data &#8216;stored&#8217; in the extension <em>is</em> already the content to be displayed!&#8221;. I don&#8217;t think so. Nowadays, the domain of an extension and the domain of the CMS are woven into another. And the following questions are answered by the extension itself:</p>
<ul>
<li>&#8220;What is the title of the article?&#8221;</li>
<li>&#8220;How many articles should be shown on the front-page?</li>
<li>&#8220;Should the subtitle of the article be emphasized?&#8221;</li>
</ul>
<p>So, we have to spend hours and hours to adapt all the templates of an extension to fit in the overall context of a web page. That&#8217;s annoying. Now, let&#8217;s try to solve that issue. The first thing is to assign the questions to the proper domain:</p>
<ul>
<li>&#8220;What is the title of the article?&#8221; → domain of the extension</li>
<li>&#8220;How many articles should be shown on the front-page? → domain of the CMS</li>
<li>&#8220;Should the subtitle of the article be emphasized?&#8221; → domain of the CMS</li>
</ul>
<p>If we finished the separation of the two domains we are ready to take the next step: mapping the domain of the extension onto the output generated by the CMS. I propose a two-step process:</p>
<ol>
<li>Map the domain objects of the extension onto the content object aggregate of the CMS</li>
<li>Transform the content object aggregate to the output format</li>
</ol>
<p>The first step maps the domain objects of the extension onto content objects. These aggregated content objects represent the structure and the semantics of the output, but not its syntax (like &#8220;&lt;h1&gt;The Title&lt;/h1&gt;&#8221;). The second step transforms the content objects to the output format. This can be done with a templating engine as usual.</p>
<p>The benefit of this two-step process is that the CMS &#8220;owns&#8221; the templates. So we can configure the visual representation of the domain objects of <em>all</em> extensions at one central place.</p>
<h3>An Example</h3>
<p>An example might clarify the process. Let&#8217;s assume I want to write a news extension. The first step is to design the domain of my new extension:</p>
<div id="attachment_171" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-171" title="news" src="http://blog.typoplanet.de/wp-content/uploads/2009/03/news-300x268.png" alt="news" width="300" height="268" /><p class="wp-caption-text">The domain model &quot;News Item&quot; of the extension</p></div>
<p>Then I have to examine, what the CMS built-in content object catalog offers to me. Hm, okay, there is already a content object called &#8220;article&#8221;. It seems to fit my purposes:</p>
<div id="attachment_174" class="wp-caption aligncenter" style="width: 274px"><img class="size-medium wp-image-174" title="article" src="http://blog.typoplanet.de/wp-content/uploads/2009/03/article-264x300.png" alt="The domain model &quot;Article&quot; of the CMS" width="264" height="300" /><p class="wp-caption-text">The domain model &quot;Article&quot; of the CMS</p></div>
<p>I configure the mapping as follows:</p>
<ul>
<li>Author → Author</li>
<li>Text  → Text</li>
<li>Title → Header</li>
<li>Subtitle → Subheader</li>
<li>Teaser → ShortDescription</li>
<li>PublishingDate → Date</li>
</ul>
<p>As a result, I have a generic &#8220;Article Object&#8221; which can be added to a higher-level content object, like &#8220;Main Content Area&#8221; or &#8220;Page&#8221;. My &#8220;News Item&#8221; will be rendered depending on the configuration of the transformation process and the context the article is displayed in. I—as an extension developer—don&#8217;t have to deal with the visualization of my domain objects.</p>
<p>But, what if I want to get the control back over the presentation of my domain object? Then I have to define my own content object class (which can of course extend an existing content object class).</p>
<p>This leads to much more decoupled way of content management based on domain driven design. That&#8217;s why I called it &#8220;Domain Driven Content Management&#8221;.</p>
<p>I&#8217;m anxious to read your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.typoplanet.de/2009/03/07/domain-driven-content-management/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Some thoughts on extension development</title>
		<link>http://blog.typoplanet.de/2009/03/03/some-thoughts-on-extension-development/</link>
		<comments>http://blog.typoplanet.de/2009/03/03/some-thoughts-on-extension-development/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 17:02:15 +0000</pubDate>
		<dc:creator>Jochen Rau</dc:creator>
				<category><![CDATA[Development Process]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[extension development]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[ontology]]></category>

		<guid isPermaLink="false">http://blog.typoplanet.de/?p=92</guid>
		<description><![CDATA[Todays development process of a TYPO3 extension can be characterized by "Database Driven Design". In this article I describe my personal vision of a more modern approach - and beyond.]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s development process of a TYPO3 extension comprises (usually) the following steps:</p>
<ol>
<li>collect clients&#8217; or personal needs</li>
<li>design the relational model (database design)</li>
<li>scaffold the extension using the kickstarter</li>
<li>add a lot of database queries template handling to the file _pi1, _pi2, _pi3 etc.</li>
<li>design the templates</li>
</ol>
<p>This ends up in an extension design which is hard to maintain &#8211; especially for larger projects. A more modern approach uses the Model View Controller Pattern.<span id="more-92"></span> One of the advantages of this pattern is to enable the developer to focus on the domain of the client (and thus the domain model of the extension). So, the MVC pattern is a prerequisite for Domain Driven Design. This leads to a slightly different development process:</p>
<ol>
<li>collect clients or personal needs</li>
<li>design the domain model (classes) translating the domain knowledge of the client into UML</li>
<li>scaffolding the extension using a kickstarter</li>
<li>adding the business logic to the domain model classes</li>
<li>design the templates</li>
</ol>
<p>What are the pros of this approach</p>
<ul>
<li>The developer and the client use a common language.</li>
<li>The domain model is more decoupled from the implementation architecture.</li>
<li>It&#8217;s clearly defined where the business logic resides (in the domain model classes).</li>
</ul>
<p>&#8230; and the cons</p>
<ul>
<li>It adds complexity to the extension.</li>
<li>It forces the developer to learn new programing paradigms, which might be difficult to schedule in the daily work.</li>
</ul>
<p>To be consequent we have to go one step further. The domain knowledge is captured in natural language. But natural language is much more expressive than object oriented software design in UML. As a consequence, there is a mismatch between the domain model expressed by the domain experts (the client) and the object oriented model expressed in UML.</p>
<p>If we want to keep all the information of the domain experts we have to define an ontology. To express the domain knowledge in an ontology, OWL seems to be a good solution to me, as it is a W3C standard and targets web applications. To edit ontologies I played around with Protégé.</p>
<p>In the end, we will have a process which can be named &#8220;Ontology Driven Extension Development Process&#8221;:</p>
<ol style="text-align: left; ">
<li>collect clients or personal needs</li>
<li>design the ontology using the same language as the client does</li>
<li>scaffolding the extension using a new ontology driven kickstarter</li>
<li>adding the business logic to the domain model classes</li>
<li>design the templates</li>
</ol>
<p>What are the pros of this approach</p>
<ul>
<li>The developer and the client use a common language.</li>
<li>The ontology based domain model is independent from the implementation and can be shared across different extensions with different purposes.</li>
</ul>
<p>&#8230; and the cons</p>
<ul>
<li>It adds complexity to the development processes.</li>
<li>It&#8217;s forces the developer to learn completely new paradigms an terms.</li>
</ul>
<p>I&#8217;m looking forward to your comments an appreciate any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.typoplanet.de/2009/03/03/some-thoughts-on-extension-development/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

