many to many problem with db_dataobject
| From: | Andreas Henden | Date: | Mon, 16 Jun 2003 13:02:01 +0000 |
| Subject: | many to many problem with db_dataobject | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5998@lists.php.net to get a copy of this message | ||
Hi
I have 3 tables. imagecat (categories), imagerel (relation) and images.
I want to load one category object and then get all the image objects
for the different images.
I have tried with a lot of different code.
One is
$imagecat = new DataObjects_Imagecat;
$imagecat->title = 'No date information in file';
$imagecat->find();
while ($imagecat->fetch()) {
$imagecat->getLinks();
$imagecat->_categoryid->find();
while ($imagecat->_categoryid->fetch()){
$imagecat->_categoryid->getLinks();
$imagecat->_categoryid->_imageid->find();
print_r($imagecat);
}
}
My links.ini file looks like this
[imagecat]
categoryid = imagerel:categoryid
[imagerel]
imageid = images:imageid
[images]
imageid = imagerel:imageid
With this example I get one imagecat object that have a imagerel object
and the imagerel has the first picture. But I want all the pictures in
that category.
Hope someone could help me with this.
From
Andreas Henden