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