Re: hasMany and find()

2014-11-19 Thread Kento Furui
Thank you again John.

I just can't see how it could not be done more easily. 
I have 1 million records for Parent model.
That sub-query could take more time than users are willing to wait.

I can write SQL like this for example

SELECT p.id, p.name, c.name FROM parents p
LEFT JOIN  children c ON p.id = c.parent_id
WHERE c.name IS NULL;

How do I make CakePHP do something like this?




2014年11月18日火曜日 3時38分31秒 UTC+9 John Andersen:

 Ok, if you cannot modify the database tables, then the other option is to 
 use sub-queries, see the CakePHP book at:
 http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#sub-queries

 My understanding of this, is that you first construct the SQL statement 
 for finding all the parent ids in the child table, then uses that SQL 
 statement as a condition for finding all parent records with the id not 
 being found by the previous SQL statement.

 Hope that helps you out :)
 Enjoy, John

 On Monday, 17 November 2014 06:05:48 UTC+2, Kento Furui wrote:

 Thank you John.

 counterCache seems to be a good idea. 
 But there must be a way to do this *without adding a column* to an 
 existing table.
 [snip]



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Question about using a CakePHP behavior

2014-11-19 Thread Sam Clauw
When you work with a self-made behavior and you create a public method in 
it, the first parameter should always be Model (predefined by CakePHP 
itself). Why is that?
I prefer to do a setter in the construct method of that behavior so I can 
call my model by $this-model...

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: hasMany and find()

2014-11-19 Thread Kento Furui
$this-Parent-recursive = -1;
$options['fields'] = array(
'Parent.id',
'Parent.name',
  );
  $options['limit'] = 1;
  $options['joins'] = array(
array(
  'type' = 'LEFT',
  'alias' = 'Children',
  'table' = 'children',
  'conditions' = array('Parent.id = Children.parent_id')));
 
  $options['conditions'] = array(
'Children.name IS NULL'
  );
  $parent_with_no_child = $this-Parent-find('all', $options);

Solved it myself.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Unable to load the webpage because the server sent no data

2014-11-19 Thread Simon Svast


Hello i have cake php 1.3 version and when i upgrade php version from 5.2 
to 5.4 cake framework stop working any idea why? That this is not issues 
with server but cake php or?

 Thank you for helping me out.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to load the webpage because the server sent no data

2014-11-19 Thread Andras Kende
CakePHP 1.3 works with php 5.4, I would try these: 

- change debug = 2 in core.php temporarily and look for errors
- delete files inside /tmp/cache/ /tmp/logs and look for errors
- make sure you have latest 1.3.20

Andras Kende



 On Nov 19, 2014, at 5:40 AM, Simon Svast videospotn...@gmail.com wrote:
 
 Hello i have cake php 1.3 version and when i upgrade php version from 5.2 to 
 5.4 cake framework stop working any idea why? That this is not issues with 
 server but cake php or?
 
  Thank you for helping me out.
 
 
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.