Welcome Guest, Not a member yet? Register   Sign In
[split] CI4 vs CI3/CI2
#1

I love CI. Have been using it for years. I have not touched version 4. For someone familiar with 2 and 3 what is the most significant achievements / feature enhancements in v4. I think v3 is great. Why would I ever want to switch to v4? I'm a bit of a simpleton, designer not really a programmer but I have found CI very easy to navigate and understand in earlier versions. The more CI becomes similar to modern PHP frameworks the less I'm honestly going to understand. I've read a bit about it and it seems like one of the major changes is namespaces. I'm not familiar with namespaces at all. I don't understand why we couldn't have just stuck to simple include/require statements. Maybe I'm a bit naive. I've also heard about composer. I've never heard of composer. I'm sure there are other changes. I just don't really understand the need to change the way things work. I've looked into systems like Laravel and was completely lost, same with Symfony. I've always felt very at home with CI even though I'm not a traditional engineer. For my clients v2 and 3 have worked well. I'm just not sold on 4. 4 just seems a lot more complex with the same end features. I have several websites running on 2 and 3 and would like to be told in a way I can understand why I should be so enthusiastic to sell clients on an upgrade to this new version which seems overly complex and difficult to understand.
Reply
#2

The main differences seem to be some syntax, resources are now loaded differently - instead of $this->load->model() you'd now use use mymodel/mymodel and views use single function, not $this->load->view().

But biggest change for me, where I had to build similar thing for v3 myself, is Entities that extend/add to Models - https://bcit-ci.github.io/CodeIgniter4/d...ities.html

It'll basically make it much easier to load and save data from DB, instead of you having to write same functions for every single model yourself.
Reply
#3

I'll let other's answer why they like it/don't like it. But I did want say two things real quick:

1. No need to upgrade your previous sites to v4 if you don't want. CI3 will still be getting support for quite some time, and your current sites will keep on working just fine.
2. Namespaces are fairly easy to wrap your head around once you dig in. I've created an article that explains them and how they work within CI in a pretty simple, clear manner, I believe.

Hope that helps!
Reply
#4

(08-22-2018, 01:30 AM)Pertti Wrote: The main differences seem to be some syntax, resources are now loaded differently - instead of $this->load->model() you'd now use use mymodel/mymodel and views use single function, not $this->load->view().

But biggest change for me, where I had to build similar thing for v3 myself, is Entities that extend/add to Models - https://bcit-ci.github.io/CodeIgniter4/d...ities.html

It'll basically make it much easier to load and save data from DB, instead of you having to write same functions for every single model yourself.

Pertti, something like Entities already exists in CI3

https://www.codeigniter.com/user_guide/d...lt-objects

Creating a parent class which the CodeIgniter "custom-result-object" class extended, I was able to add a save method pretty quickly.
In addition I added a "create" method to my parent MY_Model which would create a new / empty CodeIgniter "custom-result-object" which could be filled and finally saved.

DMyers
Reply
#5

(08-22-2018, 01:05 PM)dmyers Wrote: Pertti, something like Entities already exists in CI3

Wowzers, did not know that!

I've also managed to get few things mixed up, as I thought from memory that in CI4 the entities gave you ORM capability.

Which looks like is actually part of Model features, but also part Entity features. Hmm... looks like this guy needs to spend a his lunchbreak reading through CI4 documentation again Blush
Reply
#6

(08-23-2018, 12:52 AM)Pertti Wrote:
(08-22-2018, 01:05 PM)dmyers Wrote: Pertti, something like Entities already exists in CI3

Wowzers, did not know that!

It was me discovering that capability when digging through CI3 code that made me want to enhance that functionality. It even existed in 2, IIRC, but wasn't documented for years.

(08-23-2018, 12:52 AM)Pertti Wrote: I've also managed to get few things mixed up, as I thought from memory that in CI4 the entities gave you ORM capability.

Which looks like is actually part of Model features, but also part Entity features. Hmm... looks like this guy needs to spend a his lunchbreak reading through CI4 documentation again Blush

Just to clarify - there are no "ORM" features. The Model class provides handy CRUD functionality that was inspired by all of the MY_Model classes people were already creating. It does not, however, provide any of the methods to manage relationships, which is what an ORM does. Just needed to clarify before a rumor got started Smile
Reply
#7

(08-23-2018, 07:14 AM)kilishan Wrote: Just to clarify - there are no "ORM" features. The Model class provides handy CRUD functionality that was inspired by all of the MY_Model classes people were already creating. It does not, however, provide any of the methods to manage relationships, which is what an ORM does. Just needed to clarify before a rumor got started Smile

Looks like my self-taught coder dictionary is letting me down, again. I of course meant CRUD, all the helpful validation stuff. Probably should pick up a copy again and have a little play, see what's in and what's out.

And the only way to stop rumours is to release the darn thing Rolleyes Big Grin
Reply
#8

(08-23-2018, 07:24 AM)Pertti Wrote: And the only way to stop rumours is to release the darn thing Rolleyes Big Grin

Yeah, yeah, working on it Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB