I have a simple hierarchy like this:

Page hasMany DisplayArea
DisplayArea hasMany ContentBlock
ContentBlock hasOne Image

All is fine when I execute queries with the above associations e.g.
$this->Page->find('first', array('conditions'=>array('title
like'=>'%Home%')));

Now I want to access some Page data when dealing with a single Image.
So I added (in the appropriate models):

Image belongsTo ContentBlock
ContentBlock belongsTo DisplayArea
DisplayArea belongsTo Page

Now, when I do the exact same find() I get really strange debug
output. I see the normal DESCRIBE queries and 2 other normal
preliminary queries (generated elsewhere in my app) followed by the
query generated by my find(). Only part way through this debug output
the queries stop and the whole sequence starts over. See output:
(default) 10 queries took 24 ms Nr      Query   Error   Affected        Num. 
rows       Took
(ms)
1       DESCRIBE `pages`                7       7       4
2       DESCRIBE `display_areas`                7       7       4
3       DESCRIBE `content_blocks`               5       5       4
4       DESCRIBE `images`               12      12      4
5       DESCRIBE `configs`              3       3       3
6       SELECT `Page`.`id`, `Page`.`parent_id`, `Page`.`title`,
`Page`.`link_name`, `Page`.`script`, `Page`.`layout`,
`Page`.`description_meta` FROM `pages` AS `Page` WHERE `parent_id` = 1
                3       3       1
7       SELECT `Config`.`id`, `Config`.`name`, `Config`.`value` FROM
`configs` AS `Config` WHERE 1 = 1               12      12      1
8       SELECT `Page`.`id`, `Page`.`parent_id`, `Page`.`title`,
`Page`.`link_name`, `Page`.`script`, `Page`.`layout`,
`Page`.`description_meta` FROM `pages` AS `Page` WHERE `title` like
'%Home%' LIMIT 1                1       1       1
9       SELECT `DisplayArea`.`id`, `DisplayArea`.`page_id`,
`DisplayArea`.`name`, `DisplayArea`.`img_width`,
`DisplayArea`.`img_height`, `DisplayArea`.`thm_width`,
`DisplayArea`.`thm_height` FROM `display_areas` AS `DisplayArea` WHERE
`DisplayArea`.`page_id` = (1)           2       2       1
10      SELECT `Page`.`id`, `Page`.`parent_id`, `Page`.`title`,
`Page`.`link_name`, `Page`.`script`, `Page`.`layout`,
`Page`.`description_meta` FROM `pages` AS `Page` WHERE `Page`.`id` = 1
                1       1       1
(default) 10 queries took 24 ms Nr      Query   Error   Affected        Num. 
rows       Took
(ms)
1       DESCRIBE `pages`                7       7       4
2       DESCRIBE `display_areas`                7       7       4
3       DESCRIBE `content_blocks`               5       5       4
4       DESCRIBE `images`               12      12      4
5       DESCRIBE `configs`              3       3       3
6       SELECT `Page`.`id`, `Page`.`parent_id`, `Page`.`title`,
`Page`.`link_name`, `Page`.`script`, `Page`.`layout`,
`Page`.`description_meta` FROM `pages` AS `Page` WHERE `parent_id` = 1
                3       3       1
7       SELECT `Config`.`id`, `Config`.`name`, `Config`.`value` FROM
`configs` AS `Config` WHERE 1 = 1               12      12      1
8       SELECT `Page`.`id`, `Page`.`parent_id`, `Page`.`title`,
`Page`.`link_name`, `Page`.`script`, `Page`.`layout`,
`Page`.`description_meta` FROM `pages` AS `Page` WHERE `title` like
'%Home%' LIMIT 1                1       1       1
9       SELECT `DisplayArea`.`id`, `DisplayArea`.`page_id`,
`DisplayArea`.`name`, `DisplayArea`.`img_width`,
`DisplayArea`.`img_height`, `DisplayArea`.`thm_width`,
`DisplayArea`.`thm_height` FROM `display_areas` AS `DisplayArea` WHERE
`DisplayArea`.`page_id` = (1)           2       2       1
10      SELECT `Page`.`id`, `Page`.`parent_id`, `Page`.`title`,
`Page`.`link_name`, `Page`.`script`, `Page`.`layout`,
`Page`.`description_meta` FROM `pages` AS `Page` WHERE `Page`.`id` = 1
                1       1       1
(default) 10 queries took 24 ms
Notice (8): Trying to get property of non-object

This repeats 4 more time then ends with a Fatal error:
ConnectionManager::getDataSource - Non-existent data source

It looks to me like there is some kind of infinite loop.

If I delete
DisplayArea belongsTo Page

the find() works OK!

Any Help?

Thanks in advance,
Ken
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to