Saturday, February 25, 2012

Re: Custom model association column

Cake will automatically build that condition based off of the current model's primary key and the foreignKey you specify in the $hasMany relationship. You can supply additional conditions using the 'conditions' key on that relationship.

$hasMany = array(
'Content' => array(
'foreignKey' => 'subject_id',
'conditions' => array('Content.something' => 'Subject.nothing')
);

On Saturday, February 25, 2012 9:40:51 AM UTC-8, djogo wrote:
Hello all,

Your suggestions would work, however I`m trying to get a shortcut here
=> eliminating the Subject.

is there any way that we could specify a join condition, like

'hasMany' => array(
     'model' => 'Contents',
     'join' => 'Contents.subject_id = HospitalAdmission.subject_id'

...
)


?

On Feb 22, 6:16 am, Stephen Speakman <step...@ninjacodermonkey.co.uk>
wrote:
> Something i need to bear in mind when mapping my models, no joining
> between two connections.
>
> Could you not find a behaviour to create a temporary table as a very
> last resort?
>
> Sent from my iPhone
>
> On 21 Feb 2012, at 21:37, jeremyharris <funeralm...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Does Containable not work?
>
> > $this->HospitalAdmission->find('all', array(
> >   'contain' => array(
> >     'Subject' => array(
> >       'Contents'
> >     )
> >   )
> > ));
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > 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 athttp://groups.google.com/group/cake-php

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate