Hello, cake community.  I'm suffering through one of those frustrating
problems where things worked fine until the core was upgraded.

The app I'm currently working on uses many HABTM relationships.  Some
of the join tables for these relationships have additional fields, so
I've created models for the join tables.  In doing so, I added the
'with' key to the respective joined models. I also added belongsTo
associations in the join table models to each of the tables they join:

class Ad extends AppModel {
        var $name = 'Ad';
        var $hasAndBelongsToMany = array(
                'Rundate' =>
                    array(
                        'with' => 'AdsRundate',
                        'className'  => 'Rundate',
                        'joinTable'  => 'ads_rundates',
                        'foreignKey'  => 'ad_id',
                        'associationForeignKey'  => 'rundate_id',
                        'conditions'  => '',
                        'order' => 'Rundate.run_date ASC',
                        'limit' => '',
                        'unique'  => true,
                        'finderQuery'  => '',
                        'deleteQuery' => '',
                        'insertQuery' => ''
                    )
         );
}

class AdsRundate extends AppModel {
  var $name = 'AdsRundate';
  var $belongsTo = array(
                        'Ad' => array('className' => 'Ad',
                                                                'foreignKey' => 
'ad_id',
                                                                'conditions' => 
'',
                                                                'fields' => '',
                                                                'order' => '',
                                                                'counterCache' 
=> ''),
                        'Rundate' => array('className' => 'Rundate',
                                                                'foreignKey' => 
'rundate_id',
                                                                'conditions' => 
'',
                                                                'fields' => '',
                                                                'order' => '',
                                                                'counterCache' 
=> ''),

        );
}

In this app, to filter by the extra fields in the join tables, I've
created methods in the join table models.  I could call these as
expected e.g. $this->JoinTableModel->customMethod() which would return
the records for the join table, and its related tables records.  These
methods worked fine until I upgraded my core from 1.2.0.7296 RC2 to
1.2.2.8120.  Now in some cases methods are not found.  In other cases,
only the record for the join table is returned, and none of the
records in the belongsTo relations are returned, regardless of the
recursion level set.

It seems like my models are being ignored and auto-generated models
are being used instead.  Any suggestions on how I can make this work
again?

Thanks,

Jeff

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