No, the function is in my model so calling $this->Space->find(); results in Undefined property: Space::$Space.
The error isn't that strange, it happens because I removed the Space from the fields so that 'Space.description' became 'description. Cake thinks that 'name' is a model, which of course doesn't exist. I've posted my full Space model at http://pastebin.com/m46f3797b with some modifications. Right now I'm just testing using find('all'), but changing 'all' to 'threaded' will show the error that I mentioned in the first post. I also renamed the function and made some convenience functions. Might as well work with the parts that I can get working :) On Feb 28, 11:14 pm, mscdex <[email protected]> wrote: > On Feb 28, 2:07 pm, Dan Soendergaard <[email protected]> wrote: > > > That doesn't help much, I've tried it and it gives errors like this: > > > Model "Space" is not associated with model "name" [CORE/cake/libs/ > > model/behaviors/containable.php, line 340] > > Strange error. Is this what you tried: > > function get_structure($user = null) { > $spaces = $this->Space->find('threaded', array( > 'conditions' => array('User.id' => > $user), > 'fields' => array('Space.name', > 'Space.description', 'Space.created', 'Space.parent_id', 'Space.lft', > 'Space.rght', 'User.id', 'User.username'), > 'contain' => array( > 'User', 'Document' > ), > 'order' => array('Space.name') > ) > ); > > return array('spaces' => $spaces); > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
