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

> 3) By setting it explicitly on the model (a bit dirty)
> $this->CollegeDepartment->hasAndBelongsToMany['Organization']['fields'] = 
> array('user_id','name);

 This one works (in case someone else tries to copy&paste, 'name
should be 'name' ;-) )

Thank you,

Guy


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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