<?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: CakePHP: Working with &#8216;Associations&#8217;</title>
	<atom:link href="http://www.askaboutphp.com/31/cakephp-working-with-associations.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html</link>
	<description></description>
	<lastBuildDate>Sun, 05 Sep 2010 17:36:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tara Page</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-5409</link>
		<dc:creator>Tara Page</dc:creator>
		<pubDate>Fri, 16 Jan 2009 17:17:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-5409</guid>
		<description>One more question, can you tell me how to do the FORM for a hasMany relationship to people can enter in MULTIPLE items at once, and so the save will work correctly?  I have it written in PHP code, but want to take advantage of CAKE if possible.

The problem that I&#039;m trying to solve is to input information for Name, Description, and Title for example, in 3 different languages on the same page.  When I hit SAVE, I want it to update/add 3 records in the info table.  I&#039;m not sure if this is a good enough description of my problem, but if someone is willing to help me out I can give more info.  Thanks in advance.</description>
		<content:encoded><![CDATA[<p>One more question, can you tell me how to do the FORM for a hasMany relationship to people can enter in MULTIPLE items at once, and so the save will work correctly?  I have it written in PHP code, but want to take advantage of CAKE if possible.</p>
<p>The problem that I&#8217;m trying to solve is to input information for Name, Description, and Title for example, in 3 different languages on the same page.  When I hit SAVE, I want it to update/add 3 records in the info table.  I&#8217;m not sure if this is a good enough description of my problem, but if someone is willing to help me out I can give more info.  Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tara Page</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-5407</link>
		<dc:creator>Tara Page</dc:creator>
		<pubDate>Fri, 16 Jan 2009 15:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-5407</guid>
		<description>Hi,

Does anyone know if you can put a VARIABLE in the &#039;order&#039; portion of the Model definition?  I want to put in an order like:

order by field(language, $_SESSION[&#039;languageorder&#039;])

where the order is specific to each session, and is a comma separated list of ids (3,1,4) for example.  I cannot seem to use the variable in the code, it isn&#039;t expecting the variable and gives an error....

Thanks</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Does anyone know if you can put a VARIABLE in the &#8216;order&#8217; portion of the Model definition?  I want to put in an order like:</p>
<p>order by field(language, $_SESSION['languageorder'])</p>
<p>where the order is specific to each session, and is a comma separated list of ids (3,1,4) for example.  I cannot seem to use the variable in the code, it isn&#8217;t expecting the variable and gives an error&#8230;.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GMAFB</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-3443</link>
		<dc:creator>GMAFB</dc:creator>
		<pubDate>Fri, 07 Nov 2008 04:07:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-3443</guid>
		<description>zoli: The largest section of the post is entitled &quot;Creating the association&quot;. If you do anything with associations, you are working with associations; the title is accurate.  

But thank you for taking the time to post.  While the starving children of the world still won&#039;t have anything to eat or a home that&#039;s not a garbage can, they can face death knowing you will be out there on the internet, policing post titles.  You&#039;re a real hero.

To answer your question: you&#039;ve missed everything.</description>
		<content:encoded><![CDATA[<p>zoli: The largest section of the post is entitled &#8220;Creating the association&#8221;. If you do anything with associations, you are working with associations; the title is accurate.  </p>
<p>But thank you for taking the time to post.  While the starving children of the world still won&#8217;t have anything to eat or a home that&#8217;s not a garbage can, they can face death knowing you will be out there on the internet, policing post titles.  You&#8217;re a real hero.</p>
<p>To answer your question: you&#8217;ve missed everything.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zoli</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-3018</link>
		<dc:creator>zoli</dc:creator>
		<pubDate>Sat, 25 Oct 2008 07:40:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-3018</guid>
		<description>Your post has the title &quot;Working with associations&quot;. &quot;Displaying associations&quot; would be more correct, because there is no mention about creating/updating/destroying associations. Am I missing something?</description>
		<content:encoded><![CDATA[<p>Your post has the title &#8220;Working with associations&#8221;. &#8220;Displaying associations&#8221; would be more correct, because there is no mention about creating/updating/destroying associations. Am I missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-2952</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Thu, 23 Oct 2008 18:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-2952</guid>
		<description>I figured it out!  :)</description>
		<content:encoded><![CDATA[<p>I figured it out!  <img src='http://www.askaboutphp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-2944</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Thu, 23 Oct 2008 12:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-2944</guid>
		<description>BTW, is it a problem the Cake framework if there are other [model]_id fields in that table but are not associated in the Model classes?   Thanks!</description>
		<content:encoded><![CDATA[<p>BTW, is it a problem the Cake framework if there are other [model]_id fields in that table but are not associated in the Model classes?   Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-2942</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Thu, 23 Oct 2008 12:34:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-2942</guid>
		<description>I believe I&#039;ve followed the tutorials correctly for the hasMany relationship, but for some reason the data is not getting saved to the database table.  The save is failing and I&#039;m not sure how to tell what is causing the issue.

Anyone else seen this issue?
Here are some details:

Ticket Model with a hasMany to a Change model:
class Ticket extends AppModel
{
   var $name = &#039;Ticket&#039;;
   var $hasMany = array(&#039;Change&#039; =&gt;
	           array(&#039;className&#039; =&gt; &#039;Change&#039;,			 &#039;conditions&#039; =&gt; &#039;&#039;,
			 &#039;order&#039; =&gt; &#039;Change.modified_date DESC&#039;,
													 &#039;limit&#039;      =&gt; &#039;10&#039;,
													 &#039;foreignKey&#039;   =&gt; &#039;ticket_id&#039;,
													 &#039;dependent&#039;    =&gt; &#039;true&#039;,
													 &#039;exclusive&#039;    =&gt; &#039;false&#039;,
													 &#039;finderQuery&#039;  =&gt; &#039;&#039;,
													 &#039;fields&#039;       =&gt; &#039;&#039;,
													 &#039;offset&#039;       =&gt; &#039;&#039;,
													 &#039;counterQuery&#039; =&gt; &#039;&#039;));
...
}

class Change extends AppModel
{
   var $name = &#039;Change&#039;;
}

my &#039;changes&#039; table has &#039;id&#039; and &#039;ticket_id&#039; columns, plus some others.

my &#039;tickets&#039; table has &#039;id&#039; and &#039;change_id&#039; columns, plus some others.

I call (from the tickets_controller):
$this-&gt;Ticket-&gt;save($this-&gt;data);
(this saves good)

then I call (from the tickets_controller):
$this-&gt;Ticket-&gt;Change-&gt;save($this-&gt;data)
(this fails, not sure why, how can I extract the error)

Any tips are appreciated.
Thanks, Kevin</description>
		<content:encoded><![CDATA[<p>I believe I&#8217;ve followed the tutorials correctly for the hasMany relationship, but for some reason the data is not getting saved to the database table.  The save is failing and I&#8217;m not sure how to tell what is causing the issue.</p>
<p>Anyone else seen this issue?<br />
Here are some details:</p>
<p>Ticket Model with a hasMany to a Change model:<br />
class Ticket extends AppModel<br />
{<br />
   var $name = &#8216;Ticket&#8217;;<br />
   var $hasMany = array(&#8216;Change&#8217; =&gt;<br />
	           array(&#8216;className&#8217; =&gt; &#8216;Change&#8217;,			 &#8216;conditions&#8217; =&gt; &#8221;,<br />
			 &#8216;order&#8217; =&gt; &#8216;Change.modified_date DESC&#8217;,<br />
													 &#8216;limit&#8217;      =&gt; &#8216;10&#8242;,<br />
													 &#8216;foreignKey&#8217;   =&gt; &#8216;ticket_id&#8217;,<br />
													 &#8216;dependent&#8217;    =&gt; &#8216;true&#8217;,<br />
													 &#8216;exclusive&#8217;    =&gt; &#8216;false&#8217;,<br />
													 &#8216;finderQuery&#8217;  =&gt; &#8221;,<br />
													 &#8216;fields&#8217;       =&gt; &#8221;,<br />
													 &#8216;offset&#8217;       =&gt; &#8221;,<br />
													 &#8216;counterQuery&#8217; =&gt; &#8221;));<br />
&#8230;<br />
}</p>
<p>class Change extends AppModel<br />
{<br />
   var $name = &#8216;Change&#8217;;<br />
}</p>
<p>my &#8216;changes&#8217; table has &#8216;id&#8217; and &#8216;ticket_id&#8217; columns, plus some others.</p>
<p>my &#8216;tickets&#8217; table has &#8216;id&#8217; and &#8216;change_id&#8217; columns, plus some others.</p>
<p>I call (from the tickets_controller):<br />
$this-&gt;Ticket-&gt;save($this-&gt;data);<br />
(this saves good)</p>
<p>then I call (from the tickets_controller):<br />
$this-&gt;Ticket-&gt;Change-&gt;save($this-&gt;data)<br />
(this fails, not sure why, how can I extract the error)</p>
<p>Any tips are appreciated.<br />
Thanks, Kevin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sumit</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-1686</link>
		<dc:creator>sumit</dc:creator>
		<pubDate>Tue, 09 Sep 2008 09:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-1686</guid>
		<description>I am a newbie to cakephp.I am building the login page where the user can upload his album.For the first time the user will not see any album list and the page will display no album found and a link to upload album and album will be displayed in descending order by datecreated.I have albums_controller for album and users_controller through which i created the index page where those above mentioned information.I declared hasMany relationship on users model but don&#039;t know to produce the album views on my User index page.Any help will be highly appreciated.</description>
		<content:encoded><![CDATA[<p>I am a newbie to cakephp.I am building the login page where the user can upload his album.For the first time the user will not see any album list and the page will display no album found and a link to upload album and album will be displayed in descending order by datecreated.I have albums_controller for album and users_controller through which i created the index page where those above mentioned information.I declared hasMany relationship on users model but don&#8217;t know to produce the album views on my User index page.Any help will be highly appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: webmaster</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-552</link>
		<dc:creator>webmaster</dc:creator>
		<pubDate>Wed, 16 Jul 2008 09:56:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-552</guid>
		<description>@chacha:
Sorry this is a bit late. This post extends from the Blog application sample at http://manual.cakephp.org/view/326/the-cake-blog-tutorial, so the controller remains the same. Once associated, the comments becomes available.

@Shaun:
I know what you&#039;re asking. I think when you make the call $this-&gt;Post-&gt;findAll() in your controller, you can specify the order. Check out the cake docs. 

In any case, I&#039;ve moved onto 1.2xx version, so the function calls are a bit different now. I think it would have been something like:

$this-&gt;Post-&gt;find(&#039;all&#039;,array(&quot;order&quot;=&gt;&quot;Comments.body DESC&quot;)) to sort by the &#039;body&#039; field. Not sure if it&#039;s the same on 1.1.x version tho.
</description>
		<content:encoded><![CDATA[<p>@chacha:<br />
Sorry this is a bit late. This post extends from the Blog application sample at <a href="http://manual.cakephp.org/view/326/the-cake-blog-tutorial" rel="nofollow">http://manual.cakephp.org/view/326/the-cake-blog-tutorial</a>, so the controller remains the same. Once associated, the comments becomes available.</p>
<p>@Shaun:<br />
I know what you&#8217;re asking. I think when you make the call $this->Post->findAll() in your controller, you can specify the order. Check out the cake docs. </p>
<p>In any case, I&#8217;ve moved onto 1.2xx version, so the function calls are a bit different now. I think it would have been something like:</p>
<p>$this->Post->find(&#8216;all&#8217;,array(&#8220;order&#8221;=>&#8221;Comments.body DESC&#8221;)) to sort by the &#8216;body&#8217; field. Not sure if it&#8217;s the same on 1.1.x version tho.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaun</title>
		<link>http://www.askaboutphp.com/31/cakephp-working-with-associations.html/comment-page-1#comment-548</link>
		<dc:creator>Shaun</dc:creator>
		<pubDate>Wed, 16 Jul 2008 06:07:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=31#comment-548</guid>
		<description>how can you sort the comments listing by a field in the post model/table?</description>
		<content:encoded><![CDATA[<p>how can you sort the comments listing by a field in the post model/table?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
