So I've got 4 models set up: owner.php, property.php, street.php, and
user.php; as well as their controllers all set up. My models are as
per below:
class Owner extends AppModel
{
var $name = 'Owner';
var $belongsTo = array('User');
var $hasOne = array('Property');
}
class Property extends AppModel
{
var $name = 'Property';
var $belongsTo = array('Street', 'Owner');
}
class Street extends AppModel
{
var $name = 'Street';
var $hasMany = array('Property');
}
class User extends AppModel
{
var $name = 'User';
var $hasOne = array('Owner');
}
The streets table just has a mapping of an ID to a street name.
When I look at /myApp/properties, I see that the street_id gets mapped
properly to the street name (i.e. the Scaffold shows the street name,
from the streets table, and does not display the street_id that is in
the properties table). But why does it not do the same for users/
owners information? It shows the owner_id as a clickable link to a
view of the owner_id for the owners table, which also shows the
user_id as a clickable link to a view of the user_id for the users
table. I was expecting all of the info (from users and owners table)
to be "in-line" each row of the properties view, just like how the
street names are shown (instead of the street_id).
Do I have the relationship between the models set up incorrectly?
It seems to behave correctly in that they are linked correctly - I
just wanted the properties view to show all the related data from the
users and owners table instead of just a link to them via the ID; just
like how it is working with the streets table.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---