Monday, July 6, 2009

Re: Containable + HABTM + conditions PROBLEM [urgent]

Thanks, but it doesn't work.
Gives me this query:
SELECT `Module`.`id`, `Module`.`position`, `Module`.`name`,
`Module`.`created`, `Module`.`modified` FROM `modules` AS `Module`
WHERE `Version`.`name` = 'covermount'

and this error:
1054: Unknown column 'Version.name' in 'where clause'

On 3 Jul., 20:14, brian <bally.z...@gmail.com> wrote:
> Something like this?
>
> $modules = $this->Product->Module->find(
>         'all',
>         array(
>                 'conditions' => array(
>                         'Version.name' => $version
>                 ),
>                 'contain' => array(
>                         'Version' => array(
>                                 'fields' => array('*')
>                         )
>                 )
>         )
> );
>
> On Fri, Jul 3, 2009 at 6:00 AM, Andreas Derksen<andreasderk...@arcor.de> wrote:
> > Hi all,
> > i got some problems with my habtm containable setup. This is it:
>
> > Product HABTM Module
> > Module HABTM Version
>
> > in the Product controller i want to find all modules that belong to an
> > certain version defined in the Version model.
>
> > this was my approach:
> > $this->Product->id = $id;
> > $this->Product->find('first', array('contain' => array('Module' =>
> > array('conditions' => array('Version.name' => $version)))));
>
> > but it says:
>
> > Unknown column 'Version.name' in 'where clause'
>
> > how do i query it with or without the Containable behavior?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: