Hi
I am making the move from cake 2.x to 3.x
I am starting a new project so figured this a good time. I have been
reading the book alot and its starting to make more sense.
I have been playing with different ways of retrieving my data and am a
little confused as to the best practice method for retrieving data.
Coming from cake 2.0 This method is familiar to me:
// In a controller or table method.$query = $articles->find('all', [
'conditions' => ['Articles.created >' => new DateTime('-10 days')],
'contain' => ['Authors', 'Comments'],
'limit' => 10]);
However, cake 3.0 seems to use this method as well
$query = $articles->find('all')
->where(['Articles.created >' => new DateTime('-10 days')])
->contain(['Comments', 'Authors'])
->limit(10);
Is one "better" than the other?
Another quick question is how do I quickly identify if the above queries
did not retrieve any data? I used to check for an empty array on the
returned results.
Many Thanks!
Aaron
--
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.