Monday, March 7, 2011

HABTM: has a related data

Hello,

I have a big problem, i've got the following structure:


var $hasAndBelongsToMany = array(

'Reference' => array(
'className' => 'Reference',
'joinTable' => 'watches',
'foreignKey' => 'lot_id',
'associationForeignKey' => 'reference_id',
'unique' => true,
)
);

and

var $hasMany = array(
'Watch' => array(
'className' => 'Watch',
'foreignKey' => 'lot_id',
),


I would to paginate Lots which has no Reference

I've tried that:

$conditions['Watch.id !='] = '';
$this->paginate['Lot'] = array(
'contain' => array('Watch')
);

But it doesn't work.

An important point is maybe that this conditions is a must have only
if user select a filter.

So maybe i can't really modify the process.

Thanks in advance for our help.

Angelo


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: