Hi all,
Just started learning cakephp last week so a bit scratchy and still
learning.......
There are two tables in question here:
property -> stores rows of properties
seller -> stores sellers of the properties.
- one property can only have one seller
- one seller can have many properties
property model has its hasone definition:
// one property has one seller
var $hasOne = array(
'Seller' => array(
'className' => 'Seller',
'foreignKey' => 'id'
)
);
seller model has its hasmany defintion:
// one seller can have any number of favourites and properties
var $hasMany = array(
'Favourite' => array(
'className' => 'Favourite',
'foreignKey' => 'seller_id',
'dependent'=> true
),
'Property' => array(
'className' => 'Property',
'foreignKey' => 'seller_id'
)
);
ignore the favourites table for now...
property table contains 'seller_id'
property table
--------
id
seller_id
xxxxx
seller table
-------
id
xxxxxx
(I do have $useTable defined in each model to ensure table names are
correct)
In my browse function of the propertiescontroller I have the standard code:
$this->pageTitle = 'Browse All Properties';
$this->paginate['limit'] = 25;
$data = $this->paginate('Property');
$this->set('properties', $data);
It returns the properties but blank seller information.. it has the full
seller array with all the database fields but no values for any of them...
Can anyone shed some light on this?
I'm quite stuck here!
- Bryan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---