Assuming you are using CakePHP 2.x, then please take a look at the counterCache feature. http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#countercache-cache-your-count
Implement it and then you can use a condition where the counterCache count = 0. Enjoy, John On Friday, 7 November 2014 06:05:07 UTC+2, Kento Furui wrote: > > I have a model setup like following; > > Parent hasMany Children > > What do I do when I want to find a Parent who *doesn't have any Children*? > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
