Hi, I am still pretty new to CakePHP and I am having trouble doing something relatively simple... I have a database of members and I need to record transactions between members. At its most simple, each transaction entry needs an amount, a sender id and a receiver id. So my database looks something like this:
Table 'members' - id Table 'transactions' - id - member_to - member_from - amount It is important to differentiate between the sending member and the receiving member. I am new to hasMany, but I surmise that my controllers should look something like this: class MembersController extends AppController { var $name = 'Members'; var $hasMany = array('Credit' => array('className' => 'Transaction', 'conditions' => '', 'order' => '', 'limit' => '', 'foreignKey' => 'member_to', 'dependent' => false, 'exclusive' => false, 'finderQuery' => ''), 'Debit' => array('className' => 'Transaction', 'conditions' => '', 'order' => '', 'limit' => '', 'foreignKey' => 'member_from', 'dependent' => false, 'exclusive' => false, 'finderQuery' => '')); } class TransactionsController extends AppController { var $name = 'Transactions'; var $scaffold; var $belongsTo = array('From' => array('className' => 'Member', 'conditions' => '', 'order' => '', 'foreignKey' => 'member_from'), 'To' => array('className' => 'Member', 'conditions' => '', 'order' => '', 'foreignKey' => 'member_to')); } So, although this makes sense to me, when I load a member (using $this->Member->findById) and print out the array (using print_r()), I only see the 'Member' array... no 'Debit' or 'Credit' arrays... What am I doing wrong? Are my hasMany/belongsTo statements wrong? I get no errors. Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---