On Sunday, November 16, 2014 12:07:09 PM UTC+1, Dave Edwards wrote:
That is not the recommended why, in fact you don't need to do any of that in controllers. The documentation is just showing how to use the classes separately outside a controller.
-- Okay, I've had another look at the docs, and after a search found 4 one-line references to loadModel in 680 pages of the manual ;-(What concerns me is that as a user of the framework, I have to do a lot more work to get the same results, an example of which is on the very first page of ModelsInstead of doing this$this->request->data = $this->Articles->find('all);
You now recommend that I do this?use Cake\ORM\TableRegistry; $articles = TableRegistry::get('Articles'); $query = $articles->find(); foreach ($query as $row) { echo $row->title; }That doesn't make sense to me, and doesn't look like progress??
You can indeed do $articles = $this->Articles->find('all'); in a controller. Have you read the 2 different tutorials that we have in the manual? Or at least the documentation for controllers?
Another example is from your blog tutorial, having to create instances of newEntity before I can save a new record, or patchEntity before I can save records etc etc. Yes, I understand that you need to get an new instance of a new object before you can use it, but all this was hidden from the user before, why does the user now have to do this?
Because the way it works now. Hopefully having one extra line is not the end of the world :) Specially given all the nice things you can get by having entities.
The old Model class has been split into many parts. I tried writing a simple Users Controller in 3.xx and found that I needed to load just about every Class in the new ORM to support the various methods in the Controller, so again where is the advantage in that, making the ORM more granular, but having to load every Class anyway??
The advantage is having logic in entities, where you can implement virtual properties, custom son serialisation, or any pre/post saving logic that you need. Perhaps that is not obvious to you since you have not worked with it, but hopefully if you read the tutorials in the manual it will become more understandable.
The User manual now reads more like a technical manual rather than a user manual and has I feel been pitched at a very different level of user. It is full of jargon and 'techie speak', which the previous manuals avoided. You will put off those wishing to try out the framework, with limited skills, or trying the learn the PHP language.
That may be completely true, if you have more places where you thing the manual is not written in a friendly way let us know. We are constanly trying to improve this aspect.
Why for example have all the references to installing Cake by downloading the latest zip file from Git has been removed? Yes again I know that Composer is the *preferred* method of installation, and has many advantages of over dropping a zip file in a users local web server, but again many new users do not like using command line tools, so what's wrong with recommending Composer, but still providing instructions for other methods. The removal of this section will put off new users.
The zip installation has not been removed, you can actually download all the releases form github. It is not in the cakephp site right now as we don't put beta releases available for download.
I think that part of the problem here is that the core development team are so close to the new version that they do not see, or understand the issues this new version will bring to new and novice programmers. They've also been very quick to address the criticisms of the framework from hardcore programmers, but to the detriment of ordinary users. In fact version 3 of this framework, is so different from versions 1.xx and 2.xx perhaps you should consider re-branding the new framework, because it certainly isn't CakePHP 3.
Given the loads of good feedback that we have received for the new version I'm inclined to say otherwise. I completely agree this new version requires a bit more knowledge of php as a language (specially because we are using the latest features), but once that barrier is removed, I think it remains one of the most friendly frameworks out there.
On Friday, 14 November 2014 13:59:57 UTC, José Lorenzo wrote:Also wanted to add.... for users that are still in th e2.x way of thinking you can still use arrays for expressing queries:$this->loadModel('Articles');articles = $this->find('all', ['fields' => ['title', 'body'],'conditions' => ['id' => 1]]);
On Friday, November 14, 2014 2:49:27 PM UTC+1, José Lorenzo wrote:Dave, you probably did not read the documentation. That would be the on;y explanation to say that it is not possible to get a simple find first in 3.0: Here is an example, and please not that there is absolutely no need to create any class for this example except a single controller named Articles:$this->load('Articles');$article = $this->Articles->get(12); // Equivalent to 2.x $this->Article->find('first', array('conditions' => array('id' => 12)));$this->Articles->belongsTo('Authors'); $articles = $this->Articles->find()->contain('Authors'); // Equivalent to 2.x $this->Article->find('all' , array('contain' => 'Author')); In general all finds can be a find 'first' or a find 'all':$this->Articles->find()->contain('Authors')->first(); // Equivalent to 2.x $this->Article->find(' first', array('contain' => 'Author')); How can that be considered more difficult to use?On Friday, November 14, 2014 12:04:58 PM UTC+1, Dave Edwards wrote:
On Monday, 10 November 2014 09:28:38 UTC, Lucky1968 wrote:I posted a few questions lately but I don't get any answers at all here. Only 1 reply (and that wasn't even an answer to my problem) to 5 questions or so.Therefor I'm asking myself if the group of CakePHP developers is bleeding to death and if that's so, why?Or is there a more intensively used group somewhere?Are we waiting too long for the new CakePHP 3 version?And, like I'm reading at several places, is there a much better and more advanced alternative (Laravel) which is even more advanced than our upcoming CakePHP 3 will be?I'm a CakePHP enthusiast for many years now but I'm not an 'expert' programmer and when I started With CakePHP back then (1.3.x) there was a large community and questions were answered very quickly but that seems to have stopped for a while right now.And I can also see that in this group a while ago we got like 10 updates a day while now we only have around 3 updates a day.I don't want to change to an alternative framework at all but as I have read some comments on the upcoming CakePHP 3 and the fact that I like my code to be as much 'Cake' as possible it will require a (for me) rather steep learning curve and reading 'The Book' from scratch to take advantage of all new techniques.With this in mind I'm doubting if it wouldn't be more appropriate to start learning an alternative (more advanced?) framework right away?Thanks in advance for your commentsHi Lucky,You sound very much like me, a very strong CakePHP enthusiast, but not an expert programmer. I too started with CakePHP 1.xx and have progressed to 2.xx. I have produced some pretty impressive sites and applications, and love the simplicity of the framework.I recently dipped my toe in the water with 3.xx and have found that the new ORM will make me decide whether to stay with the Framework or look elsewhere, in fact I recently installed Laravel to have a look.Whilst the new ORM is undoubtedly more powerful and flexible, it does come at a huge cost in usability. Gone are the days where you can simply use $this->loadModel('Model') anywhere in a controller and then create a simple find first or find all, adding conditions, fields and associated tables where necessary with 'contain'. Now it seems that the Model object is split into multiple parts, so you have to decide whether you want to deal with tables, rows etc. You have to load this object, get an instance of the class, sometimes you use find, sometimes get etc. Then you have to loop through results etc etc. all to get the same result.My own personal opinion is that overall this is a backward step, as all this was previously was hidden from the user. Usually evolution of a product usually simplifies it, and for many users the complexity has increased ten fold with no obvious benefit other than perhaps reduced db calls and response times, which lets face it, unless you are creating a Facebook type of application, the server will handle adequately.What I would really like to see is some sort of simplified Model object layer which will cater for 80% of applications that do not require this new method of working.It will also not be long before the Manual refers to ORM instead of Model (enter version 3.xx RC1 stage left), so that's going to confuse new users even more looking for the M in MVC and finding ORM prominently displayed in its place instead.Let us know what direction you end up going in.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