<?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 Sequence Behavior</title>
	<atom:link href="http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/</link>
	<description>Learnings and Teachings on Web Application Development &#38; CakePHP</description>
	<lastBuildDate>Fri, 03 Feb 2012 19:44:06 +0100</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: Neil Crookes &#8212; Several great CakePHP Plugins (high quality)! &#124; MKfmn &#124; Matt Kaufman</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-15153</link>
		<dc:creator>Neil Crookes &#8212; Several great CakePHP Plugins (high quality)! &#124; MKfmn &#124; Matt Kaufman</dc:creator>
		<pubDate>Sat, 23 Jul 2011 15:55:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-15153</guid>
		<description>[...] CakePHP Sequence Behavior [...]</description>
		<content:encoded><![CDATA[<p>[...] CakePHP Sequence Behavior [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JC</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-11002</link>
		<dc:creator>JC</dc:creator>
		<pubDate>Fri, 21 Jan 2011 15:35:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-11002</guid>
		<description>First off, I think the Behavior is great, just what I needed!  A couple of issues and some feedback to round out the Behavior...

(1) I&#039;m running Cake 1.3.x and first tried as a plugin and using $actAs = array(&#039;Sequence.Sequence&#039;);
I get an error &#039;ModelBehavior class not found&#039;

I moved it over to app/model/behaviors and adjusted $actAs accordingly and it now works.

(2) It seems the Behavior is using a depreciated method Set::isEqual() so I went with this fork https://github.com/Theaxiom/sequence

(3) Ordering seems to work and I&#039;ve found the moveup() movedown() methods but when I delete records there are now gaps in the numeric ordering.  So I move a record up/down and it increments/deincrements the order column but only by one resulting in no order change when in encounters with a gap in the ordering.

(4) My controller&#039;s add() action always inserts the row with order=-1 rather than at the end of the order as the Behavior describes.  I am calling $this-&gt;MyModel-&gt;create(); which I think hinders the Behaviors ability to detect that this is a new record around line 197-200.

Any suggestion would be greatly appreciated and keep up the good work!!!</description>
		<content:encoded><![CDATA[<p>First off, I think the Behavior is great, just what I needed!  A couple of issues and some feedback to round out the Behavior&#8230;</p>
<p>(1) I&#8217;m running Cake 1.3.x and first tried as a plugin and using $actAs = array(&#8216;Sequence.Sequence&#8217;);<br />
I get an error &#8216;ModelBehavior class not found&#8217;</p>
<p>I moved it over to app/model/behaviors and adjusted $actAs accordingly and it now works.</p>
<p>(2) It seems the Behavior is using a depreciated method Set::isEqual() so I went with this fork <a href="https://github.com/Theaxiom/sequence" rel="nofollow">https://github.com/Theaxiom/sequence</a></p>
<p>(3) Ordering seems to work and I&#8217;ve found the moveup() movedown() methods but when I delete records there are now gaps in the numeric ordering.  So I move a record up/down and it increments/deincrements the order column but only by one resulting in no order change when in encounters with a gap in the ordering.</p>
<p>(4) My controller&#8217;s add() action always inserts the row with order=-1 rather than at the end of the order as the Behavior describes.  I am calling $this-&gt;MyModel-&gt;create(); which I think hinders the Behaviors ability to detect that this is a new record around line 197-200.</p>
<p>Any suggestion would be greatly appreciated and keep up the good work!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-9579</link>
		<dc:creator>Roger</dc:creator>
		<pubDate>Mon, 23 Aug 2010 02:20:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-9579</guid>
		<description>Great Behavior. I was really glad to not have to roll my own solution to this... a quick google search for &quot;cakephp sequence&quot; brought me here. :-)

Thanks for the MIT license too.</description>
		<content:encoded><![CDATA[<p>Great Behavior. I was really glad to not have to roll my own solution to this&#8230; a quick google search for &#8220;cakephp sequence&#8221; brought me here. :-)</p>
<p>Thanks for the MIT license too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Léo</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-9202</link>
		<dc:creator>Léo</dc:creator>
		<pubDate>Tue, 06 Jul 2010 20:48:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-9202</guid>
		<description>Great work!!!
That&#039;s exactly what i&#039;m looking for!!!

Thanks for shared!</description>
		<content:encoded><![CDATA[<p>Great work!!!<br />
That&#8217;s exactly what i&#8217;m looking for!!!</p>
<p>Thanks for shared!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricky Dunlop</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-8497</link>
		<dc:creator>Ricky Dunlop</dc:creator>
		<pubDate>Tue, 11 May 2010 11:25:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-8497</guid>
		<description>Hey, I just noticed a bug if using cake 1.3,
Set::isEqual is deprecated so you have to change lines 238 and 243 to use == instead.

Nice work btw.</description>
		<content:encoded><![CDATA[<p>Hey, I just noticed a bug if using cake 1.3,<br />
Set::isEqual is deprecated so you have to change lines 238 and 243 to use == instead.</p>
<p>Nice work btw.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Crookes</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-7874</link>
		<dc:creator>Neil Crookes</dc:creator>
		<pubDate>Tue, 09 Mar 2010 23:55:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-7874</guid>
		<description>@craig, thanks for that, what might work is merging the values for old groups and new groups before passing it to _getHighestOrder().

E.g. in beforeSave() &gt; Editing &gt; Changing group &gt; Order not specified section, change it to:

// Insert at end of new group
$model-&gt;data[$model-&gt;alias][$orderField] = $this-&gt;_getHighestOrder(
  $model,
  array_merge(
    $this-&gt;_oldGroups[$model-&gt;alias]
    $this-&gt;_newGroups[$model-&gt;alias]
  )
) + 1;

I&#039;ll check it out when I get chance, and add it with suitable test cases.</description>
		<content:encoded><![CDATA[<p>@craig, thanks for that, what might work is merging the values for old groups and new groups before passing it to _getHighestOrder().</p>
<p>E.g. in beforeSave() > Editing > Changing group > Order not specified section, change it to:</p>
<p>// Insert at end of new group<br />
$model->data[$model->alias][$orderField] = $this->_getHighestOrder(<br />
  $model,<br />
  array_merge(<br />
    $this->_oldGroups[$model->alias]<br />
    $this->_newGroups[$model->alias]<br />
  )<br />
) + 1;</p>
<p>I&#8217;ll check it out when I get chance, and add it with suitable test cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: craig</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-7870</link>
		<dc:creator>craig</dc:creator>
		<pubDate>Tue, 09 Mar 2010 21:08:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-7870</guid>
		<description>Great behavior -- Just what I needed!

fwiw, I&#039;m grouping on three columns, and I find that I need to specify the value for each of the three when I want to change the value of any one of them. That is, if I change the value of one grouping field, I need to also provide the existing values for the other two fields when I update the record. 

Otherwise _getHighestOrder() will not find any matching records, and will use the default start_at order number.

This is probably the expected behavior, but I thought I&#039;d mention it.</description>
		<content:encoded><![CDATA[<p>Great behavior &#8212; Just what I needed!</p>
<p>fwiw, I&#8217;m grouping on three columns, and I find that I need to specify the value for each of the three when I want to change the value of any one of them. That is, if I change the value of one grouping field, I need to also provide the existing values for the other two fields when I update the record. </p>
<p>Otherwise _getHighestOrder() will not find any matching records, and will use the default start_at order number.</p>
<p>This is probably the expected behavior, but I thought I&#8217;d mention it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Crookes</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-7633</link>
		<dc:creator>Neil Crookes</dc:creator>
		<pubDate>Mon, 22 Feb 2010 23:32:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-7633</guid>
		<description>@Aurimas, thanks, I&#039;ll check it out.</description>
		<content:encoded><![CDATA[<p>@Aurimas, thanks, I&#8217;ll check it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aurimas</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-7623</link>
		<dc:creator>Aurimas</dc:creator>
		<pubDate>Mon, 22 Feb 2010 09:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-7623</guid>
		<description>Hello, 

Thanks for fixing some problems, but found some new ^^. If both belonging models have sequence behaviour i was getting fatal error. 

Fatal error: [] operator not supported for strings in C:\..\cake\libs\model\datasources\dbo_source.php  on line 1126

For ex. User belongsTo Group and  both have behaviour attached.
Have find quick fix 171 line change:
$queryData[&#039;order&#039;]
to
$queryData[&#039;order&#039;][]

i would commit changes but never used git ^^

Regards,
Aurimas</description>
		<content:encoded><![CDATA[<p>Hello, </p>
<p>Thanks for fixing some problems, but found some new ^^. If both belonging models have sequence behaviour i was getting fatal error. </p>
<p>Fatal error: [] operator not supported for strings in C:\..\cake\libs\model\datasources\dbo_source.php  on line 1126</p>
<p>For ex. User belongsTo Group and  both have behaviour attached.<br />
Have find quick fix 171 line change:<br />
$queryData['order']<br />
to<br />
$queryData['order'][]</p>
<p>i would commit changes but never used git ^^</p>
<p>Regards,<br />
Aurimas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Crookes</title>
		<link>http://www.neilcrookes.com/2009/02/09/cakephp-sequence-behavior/comment-page-1/#comment-7413</link>
		<dc:creator>Neil Crookes</dc:creator>
		<pubDate>Thu, 11 Feb 2010 22:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.neilcrookes.com/?p=164#comment-7413</guid>
		<description>@prgTW, nice one, thanks for your contribution. I&#039;ll add the methods as soon as I get chance.</description>
		<content:encoded><![CDATA[<p>@prgTW, nice one, thanks for your contribution. I&#8217;ll add the methods as soon as I get chance.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

