hi.
I've this:
// app/models/post.php
class Post extends AppModel {
var $name = 'Post';
var $belongsTo = 'State, Region, Province, City, User, Contract,
Tipology, Category';
}
and
// app/models/region.php
class Region extends AppModel {
var $name = 'Region';
var $belongsTo = 'State';
}
when calling $this->Region->findAll(); from controller I have the
expected results:
Array
(
[0] => Array
(
[Region] => Array
(
[id] => ABR
[name] => ABRUZZO
[code] => 13
[state_id] => IT
[superficie] => 10.794 km²
[abitanti] => 1.300.000
[densita] => 120 ab./km²
[city_id] => 49
)
[State] => Array
(
[id] => IT
[name] => ITALIA
)
)
and so on, Region is linked to State model.
I only use belongsTo for my model, but now I need extra functionality.
I need to have the number of posts for each region, posts table
contains a region_id field.
is that possible? any hints how to configure relationships between
these tables?
thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---