Re: So many queries for a belongsTo association...
On Jul 30, 3:44 pm, Saymons [EMAIL PROTECTED] wrote: I found someone who has quite the same problem :http://groups.google.com/group/cake-php/browse_thread/thread/b97c38e4...https://trac.cakephp.org/ticket/2448 But in my case, there are not join at all, that makes me unhappy because it could be faster, and I could sort all my stuff snip Please check: 1. http://groups.google.com/group/cake-php/web/frequent-discussions 2. http://groups.google.com/group/cake-php/msg/c10840be78a34df0 -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: So many queries for a belongsTo association...
I found someone who has quite the same problem : http://groups.google.com/group/cake-php/browse_thread/thread/b97c38e4c36fc781/5ec8f3b72282ce69?lnk=gstq=queriesrnum=3#5ec8f3b72282ce69 https://trac.cakephp.org/ticket/2448 But in my case, there are not join at all, that makes me unhappy because it could be faster, and I could sort all my stuff On 26 juil, 21:06, R. Rajesh Jeba Anbiah [EMAIL PROTECTED] wrote: On Jul 26, 8:12 pm, Saymons [EMAIL PROTECTED] wrote: Hi everyone, I am using CakePHP 1.1.last_version_here and PostgreSQL 8.0.12 I have a question about the belongsTo association : My models are the following : Asset-HABTM Composer Composer - BelongsTo Composite(Asset) and Component(Asset) snip FWIW, http://groups.google.com/group/cake-php/web/frequent- discussions -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: So many queries for a belongsTo association...
Why ? It is just a BelongsTo association, Cake joins this on other cases... On 26 juil, 20:27, majna [EMAIL PROTECTED] wrote: cake cant join this. try with raw query. On Jul 26, 7:14 pm, Saymons [EMAIL PROTECTED] wrote: Thanks for your answer, but that's not my problem, I need $this-Asset- recursive = 2; else, I won't get all the data I need about the Asset. I don't understand why when my model gets the Composer, it does : SELECT ... FROM tbl_composer WHERE component_id=12 - gives me every composite_id (let's say 15,17 and 21) SELECT ... FROM tbl_asset WHERE id=15 SELECT ... FROM tbl_asset WHERE id=17 SELECT ... FROM tbl_asset WHERE id=21 And not something that looks more like : SELECT ... FROM tbl_composer LEFT JOIN ... as Component ON... LEFT JOIN ... as Composite ON ... WHERE component_id=12; because the Composite and the Component belongsTo the Composer. On 26 juil, 18:27, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: $this-Model-recursive = 0; ---try to put that beofre the findAll()... it will limit how manyqueriesare made and how much data is returned. Does this answer your question? On Jul 26, 8:12 am, Saymons [EMAIL PROTECTED] wrote: Hi everyone, I am using CakePHP 1.1.last_version_here and PostgreSQL 8.0.12 I have a question about the belongsTo association : My models are the following : Asset-HABTM Composer Composer - BelongsTo Composite(Asset) and Component(Asset) So an Asset can have many sons and many parents of the same type. When I'm loading an Asset, the models reads well the data about the Asset himself, but when looking to the HABTM, it reads the Composer table, and then for each row of the table, it reads the Composite and the Component : SELECT ... FROM tbl_asset WHERE id=12 - gives me data about the asset SELECT ... FROM tbl_composer WHERE component_id=12 - gives me every composite_id (let's say 15,17 and 21) but then SELECT ... FROM tbl_asset WHERE id=15 SELECT ... FROM tbl_asset WHERE id=17 SELECT ... FROM tbl_asset WHERE id=21 Is there a way that the Composer could join on the Asset table, not to have so manyqueries? Thx PS : excuse my English, i'm french --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: So many queries for a belongsTo association...
cake cant join this. try with raw query. On Jul 26, 7:14 pm, Saymons [EMAIL PROTECTED] wrote: Thanks for your answer, but that's not my problem, I need $this-Asset- recursive = 2; else, I won't get all the data I need about the Asset. I don't understand why when my model gets the Composer, it does : SELECT ... FROM tbl_composer WHERE component_id=12 - gives me every composite_id (let's say 15,17 and 21) SELECT ... FROM tbl_asset WHERE id=15 SELECT ... FROM tbl_asset WHERE id=17 SELECT ... FROM tbl_asset WHERE id=21 And not something that looks more like : SELECT ... FROM tbl_composer LEFT JOIN ... as Component ON... LEFT JOIN ... as Composite ON ... WHERE component_id=12; because the Composite and the Component belongsTo the Composer. On 26 juil, 18:27, Christopher E. Franklin, Sr. [EMAIL PROTECTED] wrote: $this-Model-recursive = 0; ---try to put that beofre the findAll()... it will limit how many queries are made and how much data is returned. Does this answer your question? On Jul 26, 8:12 am, Saymons [EMAIL PROTECTED] wrote: Hi everyone, I am using CakePHP 1.1.last_version_here and PostgreSQL 8.0.12 I have a question about the belongsTo association : My models are the following : Asset-HABTM Composer Composer - BelongsTo Composite(Asset) and Component(Asset) So an Asset can have many sons and many parents of the same type. When I'm loading an Asset, the models reads well the data about the Asset himself, but when looking to the HABTM, it reads the Composer table, and then for each row of the table, it reads the Composite and the Component : SELECT ... FROM tbl_asset WHERE id=12 - gives me data about the asset SELECT ... FROM tbl_composer WHERE component_id=12 - gives me every composite_id (let's say 15,17 and 21) but then SELECT ... FROM tbl_asset WHERE id=15 SELECT ... FROM tbl_asset WHERE id=17 SELECT ... FROM tbl_asset WHERE id=21 Is there a way that the Composer could join on the Asset table, not to have so many queries ? Thx PS : excuse my English, i'm french --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: So many queries for a belongsTo association...
$this-Model-recursive = 0; ---try to put that beofre the findAll()... it will limit how many queries are made and how much data is returned. Does this answer your question? On Jul 26, 8:12 am, Saymons [EMAIL PROTECTED] wrote: Hi everyone, I am using CakePHP 1.1.last_version_here and PostgreSQL 8.0.12 I have a question about the belongsTo association : My models are the following : Asset-HABTM Composer Composer - BelongsTo Composite(Asset) and Component(Asset) So an Asset can have many sons and many parents of the same type. When I'm loading an Asset, the models reads well the data about the Asset himself, but when looking to the HABTM, it reads the Composer table, and then for each row of the table, it reads the Composite and the Component : SELECT ... FROM tbl_asset WHERE id=12 - gives me data about the asset SELECT ... FROM tbl_composer WHERE component_id=12 - gives me every composite_id (let's say 15,17 and 21) but then SELECT ... FROM tbl_asset WHERE id=15 SELECT ... FROM tbl_asset WHERE id=17 SELECT ... FROM tbl_asset WHERE id=21 Is there a way that the Composer could join on the Asset table, not to have so many queries ? Thx PS : excuse my English, i'm french --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
So many queries for a belongsTo association...
Hi everyone, I am using CakePHP 1.1.last_version_here and PostgreSQL 8.0.12 I have a question about the belongsTo association : My models are the following : Asset-HABTM Composer Composer - BelongsTo Composite(Asset) and Component(Asset) So an Asset can have many sons and many parents of the same type. When I'm loading an Asset, the models reads well the data about the Asset himself, but when looking to the HABTM, it reads the Composer table, and then for each row of the table, it reads the Composite and the Component : SELECT ... FROM tbl_asset WHERE id=12 - gives me data about the asset SELECT ... FROM tbl_composer WHERE component_id=12 - gives me every composite_id (let's say 15,17 and 21) but then SELECT ... FROM tbl_asset WHERE id=15 SELECT ... FROM tbl_asset WHERE id=17 SELECT ... FROM tbl_asset WHERE id=21 Is there a way that the Composer could join on the Asset table, not to have so many queries ? Thx PS : excuse my English, i'm french --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: So many queries for a belongsTo association...
On Jul 26, 8:12 pm, Saymons [EMAIL PROTECTED] wrote: Hi everyone, I am using CakePHP 1.1.last_version_here and PostgreSQL 8.0.12 I have a question about the belongsTo association : My models are the following : Asset-HABTM Composer Composer - BelongsTo Composite(Asset) and Component(Asset) snip FWIW, http://groups.google.com/group/cake-php/web/frequent- discussions -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---