Ok, so what seems to be the case is that the conditions element of the
array is assumed to contain a string that can be used to compare. So
if I put in a specific bit of text, it works fine.

The difficulty here is that I'm trying to make an associating in
CakePHP that doesn't use the primary key. The SubgroupPage table uses
subgroup as it's primary key but contains the value pageid, whereas
the PageSettings table has pageid for the primary key.

On Jun 30, 3:21 pm, DragonFlyEye <[email protected]> wrote:
> Hello, again, cricket!
>
> Thanks for the help, but I'm still getting the WHERE [PageSettings].
> [pageid] = 'SubgroupPage.pageid' thing. I've never seen CakePHP react
> to a query in this manner before!
>
> On Jun 30, 2:30 pm, cricket <[email protected]> wrote:
>
> > On Wed, Jun 30, 2010 at 10:15 AM, DragonFlyEye <[email protected]> 
> > wrote:
> > > I'm trying to make an association between two models that do not use
> > > the primary key as the association. I'm not sure why I'm getting the
> > > results that I am from this:
> > > class SubgroupPage extends AppModel {
> > >        var $name               = 'SubgroupPage';
> > >        var $useTable   = 'menu_subgroup_pages';
> > >        var $primaryKey = 'subgroup';
> > >        var $hasOne     = array('PageSettings' => array('foreignKey' =>
> > > 'pageid',
> > >                                                                
> > > 'conditions' => array('PageSettings.pageid' =>
> > > 'SubgroupPage.pageid')));
>
> > Does this work?
>
> > var $hasOne = array(
> >         'PageSettings' => array(
> >                 'foreignKey' => false,
> >                 'conditions' => array(
> >                         'PageSettings.pageid' => 'SubgroupPage.pageid'
> >                 )
> >         )
> > );

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"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/cake-php?hl=en

Reply via email to