Monday, May 5, 2014

Re: TreeBehavior - reorder

ah, cool .. that’l work for now. I can also take a look at re-implementing ::reorder()


On 05 May 2014, at 15:51, José Lorenzo <jose.zap@gmail.com> wrote:

That is a feature that I left out for the time being, would you like to help us getting it back?

A workaround before the feature is implemented is using a scope:

$this->addBehavior('Tree', [
    'scope' => function($query) { return $query->order('order_by'); };
]);

The scope will be used in all the queries done by the tree behavior, so it should preserve the order when using 'recover'


On Monday, May 5, 2014 12:46:53 PM UTC+2, Thomas von Hassel wrote:
Hey

in 2.x i have a table that behaves like a tree, but has an order_by key that is used to re-order lft and rght accordinligy on a given level of the tree

I guess with this

https://github.com/cakephp/docs/pull/1324/files#diff-6e3df36e10f2470e04cdf8643e2ff73dR534

this is gone now ?


How would you handle a use-case like above with the new TreeBehavior ?

/thomas

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: