Nevermind.  I figured it out.  The model file must be the model class name
with each word separated by an under-bar.  That only took me 6 hours of
pulling my hair out!

PolicyConformanceStatement      /models/pcs.php

must be

PolicyConformanceStatement     /models/policy_conformance_statement.php

:)

On Wed, Oct 7, 2009 at 3:33 PM, DavinF <[email protected]> wrote:

> I have searched and played with trying to get the following working.
> Any help would be appreciated.
>
> The model relationships are as follows:
>
> Server -> hasMany PolicyConformanceStatements -> belongsTo PolicyCheck
>
> The model definitions are as follows:
>
> Server(/models/server.php)
>
> var $hasMany = array('PolicyConformanceStatement' => array(
>                                           'className' =>
> 'PolicyConformanceStatement',
>                                           'foriegnKey' =>
> 'srv_datum_id'
>                                           )
>                                 );
>
> PolcyConformanceStatement (/models/pcs.php)
>
> var $belongsTo = array(
>                'Server' => array('foreignKey' => 'srv_datum_id'),
>                'PolicyCheck' => array('foreignKey' =>
> 'policy_check_id')
>            );
>
>
> PolicyCheck (/models/policycheck.php)
>
>  var $hasMany = array('PolicyConformanceStatements' => array(
>                                'className' =>
> 'PolicyConformanceStatement',
>                                'foriegnKey' => 'policy_check_id'
>                            )
>                        );
>
>
> Inside the servers controller:
>            $data = $this->Server->find('first', array(
>                                                    'contain' => array
> (
>
> 'PolicyConformanceStatements' => array( 'PolicyCheck' )
>                                                     ),
>                                                    'conditions' =>
> array(
>                                                         'Server.uid'
> => $id
>                                                     )
>                                                 )
>                                         );
>
>
> The error I get is the following:
>
> Model "PolicyConformanceStatements" is not associated with model
> "PolicyCheck"
>
> Am I missing something in my setup?
>
> Thanks,
> Davin
>

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