it looks like you have the right idea, but you're leaving out a lot of
info in your associations here is an example of what you need:
class Customer extends AppModel {
var $name = 'Customer';
var $hasMany = array(
'Employee' => array(
'className' => 'Employee',
'foreignKey' => 'customer_id',
'recursive' => '1'
));
}
className is the name of your associated table's model_class,
foreignKey is the key in your associated table that refers to this
table.
On Jan 7, 11:44 pm, Travis <[EMAIL PROTECTED]> wrote:
> Ok guys,
>
> I've been working on this project for a few days and still can't get
> my associations to work. When I output debug($dataSet), and $dataSet
> = $this->Model->findAll() I only return data for the model I am
> using. Here are a couple of my models . Please let me know if there
> is someway that associations can be turned off, or if you see me
> following some non-standard convention.
>
> And I am on version 1.2.6311 beta.
>
> Thanks
>
> Travis
>
> class Customer extends AppModel {
>
> var $name = 'Customer';
> var $hasMany = 'Employee';
> var $recursive = 1;
>
> }
>
> class EmployeeModel extends AppModel
> {
> var $name = 'Employee';
> var $belongsTo = 'Customer';
> var $recursive = 2;
>
> }
>
> class Transaction extends AppModel
> {
>
> var $name = "Transaction";
> var $hasAndBelongsToMany = 'Employee';
> var $hasMany = 'OtherCosts';
> var $hasOne =
> array('Trainer','Division');
> var $recursive = 2;
> var $actsAs = array('Bindable' => array('notices' => true));
>
> }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---