I have same problem.
Two tables:
CREATE TABLE `maincats` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(255) default NULL,
`visible` tinyint(4) NOT NULL default '1',
`created` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
CREATE TABLE `categories` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(255) default NULL,
`maincat_id` int(11) default NULL,
`visible` tinyint(4) NOT NULL default '1',
`created` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
Two models:
class Maincat extends AppModel {
var $name = 'Maincat';
var $hasMany =
array('Category'=>array('className'=>'Category','foreignKey' =>
'maincat_id'));
}
class Category extends AppModel {
var $name = 'Category';
}
print_r($this->Maincat->findAll());
returns only maincats content and none sub-categories.
Array
(
[0] => Array
(
[Maincat] => Array
(
[id] => 1
[title] => Some first
[visible] => 1
[created] => 2007-02-13 14:39:28
)
)
[1] => Array
(
[Maincat] => Array
(
[id] => 2
[title] => Some second
[visible] => 1
[created] => 2007-02-13 00:00:00
)
)
)
Where is my mistake?
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---