My answers are inline:
On Monday, August 18, 2014 4:59:42 PM UTC+2, Dave Edwards wrote:
-- On Monday, August 18, 2014 4:59:42 PM UTC+2, Dave Edwards wrote:
Hi,I'm having trouble getting my head around the new ways of working with the new ORM in CakePHP 3.
That's normal, given that you are a longtime CakePHP user, hopefully it will make sense to you very fast :)
I understand that an object is now returned instead of an array, but I find the amount of new Documentation to explain the new methods of working with Models almost overwhelming. Whilst it is certainly well written, it seems to be pitched at a different (higher level) of user to previous versions. To give an example of this, the first paragraph explaining what Models are, it says 'interactions and evolution of the information workflow in your domain of work.' Sorry, but what does this really mean, in plain English?
If you have been using CakePHP for some time, then I guess you don;t need models to be explained to you. But in plain english, it is where the core of your application exists, when any user interaction is taken away. That is, all data processing, updating and the rules to follow to keep your data sane.
The documents also seem to switch backwards and forwards between different methods, such as the section called 'Find returns a query object' where it shows this method to return articles$articles = TableRegistry::get('Articles'); $query = $articles->find(); $query->where(['author_id' => 1])->order(['title' => 'DESC']);then it shows you this a few lines later$article = $this->Articles->find('all', [ 'conditions' => ['author_id' => 1] ])->first();which is much more like CakePHP 2. What's the difference, which should I be using and which is better. Do they give the same results? How do I get my data out of the objects?
Both ways are exactly the same, we offered the 2 alternatives to make users coming form 2.x feel more at home. I would say the first form is preferred as it is more flexible.
As a user of CakePHP 1.xx and 2.xx for the past 6 years, I am obviously comfortable using those versions of the framework, and the appeal of CakePHP to me has always been that it could be easily used by novices and professionals alike. I know that part of the complaint regarding previous versions of CakePHP was that queries returned data arrays, and not objects, and I'm sure that the changes to the Model layer will attract more professional users, but I hope that this isn't at the expense of those choosing a framework for the first time, or cutting their teeth on PHP.
I don't think it is, on the contrary, I feel that the ORM is much more approachable and understandable that its previous incarnations.
Now before Mark, Mark and Jose etc. jump on me, I am not being critical of their fantastic efforts to modernise the framework, or the reasons for doing so. I am also not adverse to change, especially if it is for the better, which is why I am attempting to get to know this new version, even though it is still in Alpha, and yes I have read the documentation, but the more I read the more confused I get.I know that people at this stage will say, that if I could do better, then I should contribute to the documents myself. But in order to do so, I would need to understand them first! :) They do say that programmers shouldn't write manuals, and perhaps this is a case in point?
I would like to know what is exactly confusing you, so we can help you understand how things work. Let me also suggest buying tickets for cakefest, much of the ORM internals, tips and tricks will be explained in detail there :)
Dave
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+unsubscribe@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.
No comments:
Post a Comment