#5707: find or paginate on join table dont fetch the association.
------------------------------------------------+---------------------------
Reporter: ivancasta | Owner:
Type: Bug | Status: new
Priority: High | Milestone: 1.2.x.x
Component: Model | Version: RC3
Severity: Normal | Resolution:
Keywords: association habtm paginate find | Php_version: PHP 5
Cake_version: 1.2.0.7692 |
------------------------------------------------+---------------------------
Old description:
> hi.
> i just update the cake with the nigthly build y i get one error
> i have a habtm with planes table and usuarios table.
> class PlanesUsuario extends AppModel {
>
> var $name = 'PlanesUsuario';
>
> //The Associations below have been created with all possible
> keys, those that are not needed can be removed
> var $belongsTo = array(
> 'Plan' => array('className' => 'Plan',
> 'foreignKey' => 'plan_id',
> 'conditions' => '',
> 'fields'
> => '',
> 'order'
> => ''
> ),
> 'Usuario' => array('className' => 'Usuario',
> 'foreignKey' => 'usuario_id',
> 'conditions' => '',
> 'fields'
> => '',
> 'order'
> => ''
> )
> );
>
> }
>
> well when i do a find or paginate over the jointable dont detect the
> association with the others tables.
>
> and when i do debug($this->Plan->PlanesUsuario) i can see that
> associations are empty.
>
> this only occur with the join tables.
> example:
>
> $this->Plan->PlanesUsuario->recursive=1 (or 2)
> $this->Plan->PlanesUsuario->find('all').
>
> return like the model PlanesUsuario dont have any association.
>
> with paginate() is the same.
> i have to add the association on the fly with bindModel() and then works.
>
> but with my other version i perfecttly can.
>
> thanks for all and sorry for my english.
>
> bye
New description:
hi.
i just update the cake with the nigthly build y i get one error
i have a habtm with planes table and usuarios table.
{{{
class PlanesUsuario extends AppModel {
var $name = 'PlanesUsuario';
//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $belongsTo = array(
'Plan' => array('className' => 'Plan',
'foreignKey' => 'plan_id',
'conditions' => '',
'fields'
=> '',
'order' =>
''
),
'Usuario' => array('className' => 'Usuario',
'foreignKey' => 'usuario_id',
'conditions' => '',
'fields'
=> '',
'order' =>
''
)
);
}
}}}
well when i do a find or paginate over the jointable dont detect the
association with the others tables.
[[BR]][[BR]]
and when i do debug($this->Plan->PlanesUsuario) i can see that
associations are empty.
[[BR]][[BR]]
this only occur with the join tables.
example:
{{{
$this->Plan->PlanesUsuario->recursive=1 (or 2)
$this->Plan->PlanesUsuario->find('all').
}}}
return like the model PlanesUsuario dont have any association.
with paginate() is the same.
i have to add the association on the fly with bindModel() and then works.
[[BR]][[BR]]
but with my other version i perfecttly can.
[[BR]][[BR]]
thanks for all and sorry for my english.
[[BR]][[BR]]
bye
Comment (by mark_story):
Cleaning up formatting.
--
Ticket URL: <https://trac.cakephp.org/ticket/5707#comment:1>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---