Quantcast

Duplicate query when use containable

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Duplicate query when use containable

Điển vũ
I use this query , and it created a lot duplicate query . This problem seems many people met. 
$this->Action->find('all', array(
'limit' => 60,
'order' => array('Action.created DESC'),
'contain' => array(
'Thread' => array('Game' => array('Image' => array('limit' => 1))),
'Post' => array('Thread' => array('Game' => array('Image' => array('limit' => 1)))),
'Game' => array('Image' => array('limit' => 1)),
'User' => array('Avatar')
)
)
);

I searched google a lot but i still can't find out  .  All relationship is belongsTo or hasMany. 
how can i solve this problem ?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Duplicate query when use containable

Thiago Belem
Did you set the cacheQueries model property?


--
Thiago Belem
Desenvolvedor
Rio de Janeiro - RJ - Brasil

Assando Sites - Curso online de CakePHP



On Mon, May 14, 2012 at 9:05 AM, Điển vũ <[hidden email]> wrote:
I use this query , and it created a lot duplicate query . This problem seems many people met. 
$this->Action->find('all', array(
'limit' => 60,
'order' => array('Action.created DESC'),
'contain' => array(
'Thread' => array('Game' => array('Image' => array('limit' => 1))),
'Post' => array('Thread' => array('Game' => array('Image' => array('limit' => 1)))),
'Game' => array('Image' => array('limit' => 1)),
'User' => array('Avatar')
)
)
);

I searched google a lot but i still can't find out  .  All relationship is belongsTo or hasMany. 
how can i solve this problem ?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Duplicate query when use containable

Điển vũ
I don't use cacheQueries but I tested with cacheQueries = true or false , no change happen.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Duplicate query when use containable

Điển vũ
I found out this problem cause by my SQL table design mistakes.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Loading...