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 comments
>>
>
> Hi 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 [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.