I'm having troubles to restrict a find operation based on a related model field within a hasAndBelongsToMany relationship.
// Wedding Model
public $hasAndBelongsToMany = array('Guest');
// Guest Model
public $hasAndBelongsToMany = array('Wedding');
Then, calling in Guest Controller:
// GuestsController Controller
$this->Guest->find('first', array(
'conditions' => array(
'Guest.email' => 'test@test.com',
'Wedding.alias' => 'maria-wedding'
),
'recursive' => 1
);
ERROR:
Column not found: 1054 Unknown column 'Wedding.alias' in 'where clause'
SQL Query: SELECT `Guest`.`id`, `Guest`.`created`, `Guest`.`modified`, `Guest`.`name`, `Guest`.`email`, `Guest`.`enabled`, `Guest`.`confirmed`
FROM `weddingshare`.`demo_guests` AS `Guest` WHERE `Guest`.`email` = 'test@test.com' AND `Wedding`.`alias` = 'maria-wedding' LIMIT 1
I understand it is not event joining tables to make the request.
Please, I'd appreciate any help.
Regards
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment