<?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>IBM software &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/ibm-software/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Which Model Should Contain That Method?</title>
		<link>/2010/07/28/which-model-should-contain-that-method/</link>
		<comments>/2010/07/28/which-model-should-contain-that-method/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 15:07:41 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Business/Finance]]></category>
		<category><![CDATA[Computer science]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Data management]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database management systems]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[From]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[IBM software]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL keywords]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1866</guid>
		<description><![CDATA[Let&#8217;s say you have two models &#8211; each one modeling a database table &#8211; Users &#38; Article. Here there&#8217;s nothing to deal with Zend Framwork, but you can think of them as typical models in a ZF application. What happens if you have to write a getUserArticles method? Where would you put it? Whether this &#8230; <a href="/2010/07/28/which-model-should-contain-that-method/" class="more-link">Continue reading <span class="screen-reader-text">Which Model Should Contain That Method?</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/05/fetching-rows-with-zend_db-fetch/" rel="bookmark" title="Fetching Rows With Zend_Db fetch()">Fetching Rows With Zend_Db fetch() </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s say you have two models &#8211; each one modeling a database table &#8211; <strong>Users</strong> &amp; <strong>Article</strong>. Here there&#8217;s nothing to deal with Zend Framwork, but you can think of them as typical models in a ZF application.</p>
<p>What happens if you have to write a getUserArticles method? Where would you put it? Whether this will be the User model or the Article model?<a href="/wp-content/uploads/2010/07/question.jpg"><img class="aligncenter size-full  wp-image-1875" title="question" src="/wp-content/uploads/2010/07/question.jpg" alt="Where?" width="430" height="231" srcset="/wp-content/uploads/2010/07/question.jpg 430w, /wp-content/uploads/2010/07/question-300x161.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>Although technically you can put it in both models my advice is to look at the SQL query. If the FROM clause is containing the user table &#8211; than put the method in the User model, but here you&#8217;d have something like:</p>
<pre lang="sql">
SELECT * FROM Article WHERE user_id = 1
</pre>
<p>I&#8217;d prefer to place it in the Article model!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/05/fetching-rows-with-zend_db-fetch/" rel="bookmark" title="Fetching Rows With Zend_Db fetch()">Fetching Rows With Zend_Db fetch() </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/28/which-model-should-contain-that-method/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
