Hello,

First I'd like to thank the developers on the CakePHP project. It's a
great framework and it made things a lot easier. I got my new news
system up and running in no time and my boss was real happy with it.
The old news system was a big mess and refused to do its job any
longer.

I'm currently working on a new project: It has a model named Task,
which has two relations:

belongsTo => Task
hasMany => Task

You guessed it: It's a tree structure composed of tasks that can have
many subtasks, which in turn again can have subtasks. Each tasks in
turn can only have one parent task.

I tried to run this, but I get an error when trying to display a list
of tasks:

Warning: Invalid argument supplied for foreach()

When I set the DEBUG setting to two, I get a more detailed description
of the problem and it seems that it is related to the SQL query:

SELECT `Task`.`id`, `Task`.`task_id`, `Task`.`project_id`,
`Task`.`description`, `Task`.`id`, `Task`.`task_id`,
`Task`.`project_id`, `Task`.`description` , `Project`.`id`,
`Project`.`name`, `Scheduleitem`.`id`, `Scheduleitem`.`project_id`,
`Scheduleitem`.`task_id`, `Scheduleitem`.`deadline`,
`Scheduleitem`.`hoursneeded`, `Scheduleitem`.`hoursscheduled` FROM
`tasks` AS `Task` LEFT JOIN `tasks` AS `Task` ON `Task`.`task_id` =
`Task`.`id` LEFT JOIN `projects` AS `Project` ON `Task`.`project_id` =
`Project`.`id` LEFT JOIN `scheduleitems` AS `Scheduleitem` ON
`Scheduleitem`.`task_id` = `Task`.`id` WHERE 1 = 1

This query generates the following error:

1066: Not unique table/alias: 'Task'

Anyone have an idea how this can be solved? Or do I need to file this
as a bug in the framework...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to