Ex.:
-- database.php
....
var $array_db = array('datasource' => 'ArraySource');
....
-- income.php
<?php
class Income extends AppModel {
var $name = 'Income';
var $useDbConfig = 'array_db';
var $records = array(
array('id' => 1, 'name' => 'Do not disclose'),
array('id' => 2, 'name' => '£15,000 - £25,000'),
array('id' => 3, 'name' => '£25,000 - £35,000'),
);
var $hasMany = array(
'OtherModel' => array(
'className' => 'OtherModel',
'foreignKey' => 'income_id',
)
);
}
?>
Then you can use Income model as usual.
$this->OtherModel->Income->find('list');
or, save/find the relation in the database (you may need to create the income_id field manually).
I'm sorry if this is not what you were looking for, I may not have understood your question. =)
best regards,
LipeDjow
-- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment