<?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: Attaching and detaching model behaviors on-the-fly</title>
	<atom:link href="http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 16 Mar 2010 00:59:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Recent Links Tagged With "model" - JabberTags</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-114758</link>
		<dc:creator>Recent Links Tagged With "model" - JabberTags</dc:creator>
		<pubDate>Wed, 17 Dec 2008 17:34:31 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-114758</guid>
		<description>[...] public links &gt;&gt; model   The Martiel-Goldbeter model Saved by utriel on Wed 03-12-2008   Comment on Attaching and detaching model behaviors on-the-fly by ... Saved by krisleslie on Tue 02-12-2008   Feasibility of PLoS ONE’s Peer Review Model? Saved by [...]</description>
		<content:encoded><![CDATA[<p>[...] public links &gt;&gt; model   The Martiel-Goldbeter model Saved by utriel on Wed 03-12-2008   Comment on Attaching and detaching model behaviors on-the-fly by &#8230; Saved by krisleslie on Tue 02-12-2008   Feasibility of PLoS ONE’s Peer Review Model? Saved by [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-102674</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 14 Aug 2008 16:05:12 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-102674</guid>
		<description>@kabturek: Thanks for the hint! It is now fixed in the article.</description>
		<content:encoded><![CDATA[<p>@kabturek: Thanks for the hint! It is now fixed in the article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kabturek</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-102517</link>
		<dc:creator>kabturek</dc:creator>
		<pubDate>Tue, 12 Aug 2008 16:11:44 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-102517</guid>
		<description>just a little update. in the freshest cake one should use 
&lt;code&gt;
$this-&gt;Model-&gt;Behaviors-&gt;attach()/detach();
&lt;/code&gt;
Model::Behaviors is an instance of BehaviorsCollection

http://api.cakephp.org/class_behavior_collection.html</description>
		<content:encoded><![CDATA[<p>just a little update. in the freshest cake one should use<br />
<code>$this-&gt;Model-&gt;Behaviors-&gt;attach()/detach();</code><br />
Model::Behaviors is an instance of BehaviorsCollection</p>
<p><a href="http://api.cakephp.org/class_behavior_collection.html" rel="nofollow">http://api.cakephp.org/class_behavior_collection.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: モデルのビヘイビアを動的に切り替える &#124; Sun Limited Mt.</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-79002</link>
		<dc:creator>モデルのビヘイビアを動的に切り替える &#124; Sun Limited Mt.</dc:creator>
		<pubDate>Mon, 31 Mar 2008 07:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-79002</guid>
		<description>[...] CakePHP 1.2 から追加されたビヘイビアが動的に追加、削除できるようになるようです。 Attaching and detaching model behaviors on-the-fly - cakebaker [...]</description>
		<content:encoded><![CDATA[<p>[...] CakePHP 1.2 から追加されたビヘイビアが動的に追加、削除できるようになるようです。 Attaching and detaching model behaviors on-the-fly &#8211; cakebaker [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-65340</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 11 Feb 2008 16:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-65340</guid>
		<description>@Boris: No, this feature is not yet in a release. As I have mentioned in the article it has been added in changeset 6415. So to use this feature you either have to use the version from the development branch or to wait for the next release...</description>
		<content:encoded><![CDATA[<p>@Boris: No, this feature is not yet in a release. As I have mentioned in the article it has been added in changeset 6415. So to use this feature you either have to use the version from the development branch or to wait for the next release&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris Barroso</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-65080</link>
		<dc:creator>Boris Barroso</dc:creator>
		<pubDate>Mon, 11 Feb 2008 01:50:26 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-65080</guid>
		<description>I use the beta version 1.2.0.6311-beta
So I think it should work the attach and detach behaviours.</description>
		<content:encoded><![CDATA[<p>I use the beta version 1.2.0.6311-beta<br />
So I think it should work the attach and detach behaviours.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Attaching and detaching model behaviors on-the-fly - cakebaker &#124; Sun Limited Mt.</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-64339</link>
		<dc:creator>Attaching and detaching model behaviors on-the-fly - cakebaker &#124; Sun Limited Mt.</dc:creator>
		<pubDate>Fri, 08 Feb 2008 06:57:10 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-64339</guid>
		<description>[...] CakePHP 1.2 から追加されたビヘイビアが動的に追加、削除できるようになるようです。 Attaching and detaching model behaviors on-the-fly - cakebaker [...]</description>
		<content:encoded><![CDATA[<p>[...] CakePHP 1.2 から追加されたビヘイビアが動的に追加、削除できるようになるようです。 Attaching and detaching model behaviors on-the-fly &#8211; cakebaker [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-64165</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 07 Feb 2008 16:17:17 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-64165</guid>
		<description>@Boris: Hm, do you use the CakePHP version from the development branch?</description>
		<content:encoded><![CDATA[<p>@Boris: Hm, do you use the CakePHP version from the development branch?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris Barroso</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-64027</link>
		<dc:creator>Boris Barroso</dc:creator>
		<pubDate>Thu, 07 Feb 2008 04:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-64027</guid>
		<description>I have tried this with the Translate behaviour and it didn&#039;t work

class Page extends AppModel
{
    var $displayField = &#039;name&#039;;
    var $actsAs = array();
    
    function setLanguage($lang=null)
    {
        if($lang==null)
            $lang = Configure::read(&#039;Config.language&#039;);
        else
            Configure::write(&#039;Config.language&#039;,$lang);
            
        if(DEFAULT_LANGUAGE!=$lang)
            $this-&gt;actsAs = array(&#039;Translate&#039; =&gt; array(&#039;content&#039;, &#039;name&#039;, &#039;title&#039;));
        $this-&gt;__construct(false, null, null);
    }
    
}

This is my model Page, when I set up to the default language it retrives information from the pages tables, but if I change the language it retrives using the Translate behaviour from i18n table.
What I should do I have tried this and didn&#039;t work

class Page extends AppModel
{
    var $displayField = &#039;name&#039;;
    var $actsAs = array(&#039;Translate&#039; =&gt; array(&#039;content&#039;, &#039;name&#039;, &#039;title&#039;));
    
    function setLanguage($lang=null)
    {
        if($lang==null)
            $lang = Configure::read(&#039;Config.language&#039;);
        else
            Configure::write(&#039;Config.language&#039;,$lang);
            
        if(DEFAULT_LANGUAGE==$lang)
            $this-&gt;detach(&#039;Translate&#039;);
    }
    
}</description>
		<content:encoded><![CDATA[<p>I have tried this with the Translate behaviour and it didn&#8217;t work</p>
<p>class Page extends AppModel<br />
{<br />
    var $displayField = &#8216;name&#8217;;<br />
    var $actsAs = array();</p>
<p>    function setLanguage($lang=null)<br />
    {<br />
        if($lang==null)<br />
            $lang = Configure::read(&#8216;Config.language&#8217;);<br />
        else<br />
            Configure::write(&#8216;Config.language&#8217;,$lang);</p>
<p>        if(DEFAULT_LANGUAGE!=$lang)<br />
            $this-&gt;actsAs = array(&#8216;Translate&#8217; =&gt; array(&#8216;content&#8217;, &#8216;name&#8217;, &#8216;title&#8217;));<br />
        $this-&gt;__construct(false, null, null);<br />
    }</p>
<p>}</p>
<p>This is my model Page, when I set up to the default language it retrives information from the pages tables, but if I change the language it retrives using the Translate behaviour from i18n table.<br />
What I should do I have tried this and didn&#8217;t work</p>
<p>class Page extends AppModel<br />
{<br />
    var $displayField = &#8216;name&#8217;;<br />
    var $actsAs = array(&#8216;Translate&#8217; =&gt; array(&#8216;content&#8217;, &#8216;name&#8217;, &#8216;title&#8217;));</p>
<p>    function setLanguage($lang=null)<br />
    {<br />
        if($lang==null)<br />
            $lang = Configure::read(&#8216;Config.language&#8217;);<br />
        else<br />
            Configure::write(&#8216;Config.language&#8217;,$lang);</p>
<p>        if(DEFAULT_LANGUAGE==$lang)<br />
            $this-&gt;detach(&#8216;Translate&#8217;);<br />
    }</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/comment-page-1/#comment-63048</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 04 Feb 2008 16:06:24 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/02/02/attaching-and-detaching-model-behaviors-on-the-fly/#comment-63048</guid>
		<description>@Tarique, Marc: Thanks for your comments!</description>
		<content:encoded><![CDATA[<p>@Tarique, Marc: Thanks for your comments!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
