Monday, February 10, 2014

Re: Tree recover() method and alternative parent_id field

See http://stackoverflow.com/questions/21652535/cakephp-tree-recover-method-returning-an-sql-error


Am Samstag, 8. Februar 2014 22:57:06 UTC+1 schrieb Andrew Cross:
Hello,

I'm trying to use the recover() method described here: http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::recover, unfortunately, whenever I run it I get the follow error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'recover' at line 1

Is this a bug or would it appear I'm doing something wrong?

Furthermore, I do not have a field called parent_id in my table, it is called idParent, is there anyway of forcing this field to be used?

I can successfully run the find() function on my model without issue (i.e. $this->Category->find('all');) but not $this->Category->recover();

This is how I'm calling it, I've tried calling it directly from the CategoryController as well but that errors exactly the same.

public function beforeRender()
{
$this->loadModel('Category');
$this->Category->recover();
                }

--
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/groups/opt_out.

No comments: