Well, I think the quick tip from nate about ad.hoc joins (
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-...
) is exactly what I need.
I tried it like this:
$checklist = $this->Checklist->Product->Module->find('matches', array
(
'model' => 'Version',
'scope' => array('Version.name' => 'short')
));
this gives me:
SQL Error: 1054: Unknown column 'Module.Version' in 'field list' [CORE
\cake\libs\model\datasources\dbo_source.php, line 525]
with this sql:
Query: SELECT `Module`.`Version`, `Module`.`Array`, `Module`.`id` FROM
`modules` AS `Module` WHERE matches LIMIT 1
why he does an sql like this?!
i just copied the code from nates post to my appcontroller...
perhaps its easier in normal sql, but as im not an sql professional i
wanted to do it the cakeish way..
Thanks for any help...
On 6 Jul., 09:31, "Andreas D." <andreasderk...@arcor.de> wrote:
> 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?