It might be because your model filenames do not match cake's
conventions.
Try renaming your model files to `tasks_priority.php` and
`tasks_list.php` respectively.


On Jan 30, 12:49 pm, manish <[EMAIL PROTECTED]> wrote:
> I already tried that too. But for nothing. The SQL the Cake debugging
> shows is:
>
> 18      SELECT `TasksList`.`id`, `TasksList`.`task_name`,
> `TasksList`.`task_description`, `TasksList`.`project_id`,
> `TasksList`.`initial_estimate`, `TasksList`.`time_spent`,
> `TasksList`.`tasks_priorities_id`, `TasksList`.`task_assigned_to`,
> `TasksList`.`created`, `TasksList`.`modified` FROM `tasks_lists` AS
> `TasksList` WHERE 1 = 1
>
> On Jan 30, 5:46 pm, grigri <[EMAIL PROTECTED]> wrote:
>
> > As Matias Lespiau suggested, check your recursive setting.
>
> > What SQL is cake generating for your findAll query?
>
> > On Jan 30, 12:39 pm, manish <[EMAIL PROTECTED]> wrote:
>
> > > Thanks for your reply,
> > > I have removed $uses from my models.
> > > I also tried your way as you pasted here, but still no answer.
> > > The SQL dump for two of my models is:
>
> > > Model : /app/models/TasksPriority.php
> > > CREATE TABLE `tasks_priorities` (
> > >   `id` int(11) NOT NULL auto_increment,
> > >   `priority_description` text NOT NULL,
> > >   PRIMARY KEY  (`id`)
> > > ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
>
> > > Model: /app/models/TasksList.php
> > > CREATE TABLE `tasks_lists` (
> > >   `id` int(11) NOT NULL auto_increment,
> > >   `task_name` text NOT NULL,
> > >   `task_description` text,
> > >   `project_id` int(11) NOT NULL,
> > >   `initial_estimate` int(11) NOT NULL,
> > >   `time_spent` int(11) default NULL,
> > >   `tasks_priorities_id` int(11) NOT NULL,
> > >   `task_assigned_to` int(11) NOT NULL,
> > >   `created` datetime NOT NULL,
> > >   `modified` datetime NOT NULL,
> > >   PRIMARY KEY  (`id`)
> > > ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
>
> > > On Jan 30, 5:28 pm, grigri <[EMAIL PROTECTED]> wrote:
>
> > > > Shouldn't your first association be:
>
> > > > var $belongsTo = array(
> > > >                                         'TasksPriority' => array(
> > > >                                         'className' =>
> > > > 'TasksPriority',
> > > >                                         'foreignKey' =>
> > > > 'tasks_priorities_id'
> > > >                                 )
> > > >                         );
>
> > > > ? Double-check all your database keys and make sure they are properly
> > > > referenced in the associations array.
>
> > > > If you have more trouble with this, paste both your SQL dump (the
> > > > relevant bits) and your database schema here.
>
> > > > Also, $uses() does absolutely nothing in a model. It's a controller
> > > > variable.
>
> > > > On Jan 30, 12:18 pm, manish <[EMAIL PROTECTED]> wrote:
>
> > > > > I have defined association between Two of my models:
>
> > > > > /app/models/TasksList.php
> > > > > <?php
> > > > > class TasksList extends AppModel {
> > > > > var $useTable = 'tasks_lists';
> > > > > var $uses=array('TasksPriority','TasksList');
> > > > > var $belongsTo = array(
> > > > >                                         'TasksPriority' => array(
> > > > >                                         'className' => 
> > > > > 'TasksPriority',
> > > > >                                         'foreignKey' => 'id'
> > > > >                                 )
> > > > >                         );}
>
> > > > > ?>
>
> > > > > /app/models/TasksPriority.php
> > > > > <?php
> > > > > class TasksPriority extends AppModel {
> > > > >         var $uses=array('TasksPriority','TasksList');
> > > > >         var $useTable = 'tasks_priorities';
> > > > >         var $hasMany = array(
> > > > >         'TasksList' => array(
> > > > >             'className'    => 'TasksList',
> > > > >             'foreignKey'    => 'tasks_priorities_id'
> > > > >         )
> > > > >     );}
>
> > > > > ?>
>
> > > > > In my controller I use following to display the result:
>
> > > > > $taskslist = $this->TasksList->findAll();
> > > > > pr($taskslist);
>
> > > > > The array here only prints the data from TasksList and not the
> > > > > associated data. I don't know any way I could use to find where I am
> > > > > wrong.
>
> > > > > I will really appreciate any idea!
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to