On Feb 21, 7:44 pm, "codecowboy" <[EMAIL PROTECTED]> wrote:
> > 1) By defining it in the association directly
> > <?php
> > class CollegeDepartmentextends AppModel
> > {
> >     var $name = 'CollegeDepartment';
> >     var $hasAndBelongsToMany = array('Organization' =>
> >                         array(
> >                               'fields'   => array('user_id','name')
> >                         )
> >                   );}
>
> > ?>
>
>   This one works as typed.  Thank you.
>
> > 2) by binding a parameter (don't think this currently works)
> > $this->CollegeDepartment->bindModel('Organization'=>array('fields'=>array('user_id','name));
>
>  This one does not work.  I had to change the code to:
>     
> $this->CollegeDepartment->bindModel(array('hasAndBelongsToMany'=>array('Organization'=>array('fields'=>array('user_id','name')))));
>
>  That still does not work.  I do not understand why (1) works but not
> (2).  They should both be using the same functions within the model
> controller.  I tried to look
>  into the cake core but I didn't really understand why it wasn't
> working.  Do you know if bindModel is fixed in cake 1.2?  It would be
> great if it were because
>  otherwise you would need to create multiple habtm associations for
> the same two tables just to specify different field sets.  Let me know
> if you find out anything
>  else on this topic.

Yeah I was a bit lazy writing out the array oops :).

An upgrade appears to be in order to make that work - This changeset
fixes the problem of all the keys being ignored:
https://trac.cakephp.org/changeset/4389/branches/1.1.x.x/cake/libs/model/model_php4.php

So it's fixed in both branches already. Thanks for replying.

Cheers,

AD


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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