Added the Containable behavior back into the AppModel, since it's obviously getting used in every controller.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@91 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-10 21:09:23 +00:00
parent 8d062ab92e
commit 18b928411b
9 changed files with 67 additions and 76 deletions

View File

@@ -117,26 +117,27 @@ class CustomersController extends AppController {
$this->redirect(array('action'=>'index'));
}
$this->Customer->Behaviors->attach('Containable');
$this->Customer->contain
(array(// Models
'Contact' =>
array(// Models
'ContactPhone',
'ContactEmail',
'ContactAddress',
),
'Account',
'Lease' =>
array('Unit' =>
array('order' => array('sort_order'),
'fields' => array('id', 'name'),
),
),
)
);
$customer = $this->Customer->read(null, $id);
$this->Customer->Behaviors->detach('Containable');
$customer = $this->Customer->find
('first', array
('contain' => array
(// Models
'Contact' =>
array(// Models
'ContactPhone',
'ContactEmail',
'ContactAddress',
),
'Account',
'Lease' =>
array('Unit' =>
array('order' => array('sort_order'),
'fields' => array('id', 'name'),
),
),
),
'conditions' => array('Customer.id' => $id),
));
// Add the lease balance to each lease.
foreach ($customer['Lease'] AS &$lease) {