That error occurs when Cake doesn't recognise a function/method, so it
passes it directly to the DB query. The problem is that you have
$actAs; it should be $actsAs. A fairly common error, I think.

As for the model being passed as a param, you can ignore it. The
behavior takes care of that. The documentation is a little confusing
that way.

On Wed, Aug 12, 2009 at 5:18 PM, Cris Sawfish<[email protected]> wrote:
>
> Hi 2 all,
>
> I'm building a web app and a I have to store some data in hierarhical
> order (parent - child) similar to the 'categories example' in the
> documentation. So I decided to use the Tree behaviour.
> To practice a little bit with the TreeBehaviour, I tried to follow the
> example but without any luck...
> In the model, I have set the $actAs variable to be array('Tree').
> I created a dummy test() method in my controller that calls the
> generatetreelist() method and outputs (using debug() ) the data.
>
> The problem is that generatetreelist() method, as written in the
> example, keeps returning an SQL error. The message that cakephp
> outputs is this
>
> ##########
> Warning (512): SQL Error: 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 'generatetreelist' at line 1 [CORE/cake/libs/
> model/datasources/dbo_source.php, line 524]
>
> Code | Context
>
> $sql    =       "generatetreelist"
> $error  =       "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 'generatetreelist' at line 1"
> $out    =       null
>
>            $out = null;
>            if ($error) {
>                trigger_error("<span style = \"color:Red;text-
> align:left\"><b>SQL Error:</b> {$this->error}</span>",
> E_USER_WARNING);
>
> DboSource::showQuery() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 524
> DboSource::execute() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 201
> DboSource::fetchAll() - CORE/cake/libs/model/datasources/
> dbo_source.php, line 336
> DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
> line 297
> Model::call__() - CORE/cake/libs/model/model.php, line 441
> Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 52
> Section::generatetreelist() - [internal], line ??
> SectionsController::test() - APP/controllers/sections_controller.php,
> line 7
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 116
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 227
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 194
> [main] - APP/webroot/index.php, line 88
>
> Query: generatetreelist
> ######
>
> After searching the api, i found out that the first parameter of
> generatetreelist() is an instance of the model, so I made the
> appropriate modifications to the call but without any luck. I keep
> getting the same erros as above.
>
> I came up with an alternative solution, using the findThreaded()
> method (which btw I assume that it does not require the Tree
> Behaviour) that could do the job, but I really want to find out what
> am I doing wrong with the TreeBehaviour.
>
> Could anyone give me some help about that?
>
> Thank you in advance
> Christos
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to