Welcome Guest, Not a member yet? Register   Sign In
Add namespaces in codeigniter 3
#6

(01-16-2015, 05:00 PM)rtorralba Wrote: Hi,

I agree and known your namespaces explanation.

I meant what you said in this paragraph:

Quote:Further, this process has nothing to do with namespaces, except for the fact that the model method in the loader was not designed to handle namespaced models (because namespaces did not exist in PHP when the loader was designed), so it may not be able to load your model if your model is in a namespace.

Namespaces doesn't existed when loader was designed for codeigniter 2, I talked about new features for codeigniter 3.

CodeIgniter 3 has been in development for a long time and is nearly ready for release. At this point, they're not really looking at new features for CI 3.

(01-16-2015, 05:00 PM)rtorralba Wrote: I know exactly how loader class works, simply i want to say that code like other frameworks i seem more clear and readable, maybe also more repetitive.

E.g.:


Code:
Yii:

$model = new \app\models\Users;

Codeigniter:

$this->load->model("users_model", "users")

It was just an opinion.

I like codeigniter framework and i like its simplicity and ease, and i want that it will kept equal. just i think can will add some concepts like composer use, that not will make it more difficult.

I think too, that is difficult establish how many new concepts to add to improve codeigniter without make it too much complicated and increase his bootstrap work.

Greetings.

There is nothing stopping you from using $model = new \app\models\Users; in CodeIgniter 2 or 3. However, if you haven't included the file which defines the class \app\models\Users, you need an autoloader which can find the class. If you want to use Composer to do this, you can, and CI 3 includes a configuration option to automatically load Composer if you don't want to load it yourself.
Reply


Messages In This Thread
Add namespaces in codeigniter 3 - by rtorralba - 01-16-2015, 03:32 AM
RE: Add namespaces in codeigniter 3 - by mwhitney - 01-16-2015, 11:51 AM
RE: Add namespaces in codeigniter 3 - by mwhitney - 01-20-2015, 08:54 AM
RE: Add namespaces in codeigniter 3 - by sv3tli0 - 01-20-2015, 09:23 AM
RE: Add namespaces in codeigniter 3 - by qury - 12-04-2017, 04:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB