Tuesday, April 20, 2010

Codeigniter changes from Model to CI_Model

Codeigniter 2.0 is comming up, although we are still months from the final release, the development is still moving full steam ahead. Accordingly, the latest changes to CI 2.0 was the change from extending your class from Model to CI_Model.



If you download the latest alpha builds from svn servers, you will notice that if you declare your class like this:



class pagemodel extends Model {}

in CI 2.0, it will generate a Fatal Error, complaining that the Model class has not been defined. What has happened is that they are changing the naming from Model to CI_Model, so this works perfectly:





class pagemodel extends CI_Model {}



Now there are discussions internally and externally that if the naming of the Model class is changed, then the naming of the Controller also must be changed to CI_Controller:



"changing the Controller to CI_Controller is one of the things we're discussing. It's a bit of find and replace, and an x.0 is the correct time to make those decisions. Honestly, we haven't fully decided yet; there are pros and cons to each."



Apparantly this change has been made so as to provide more consistency in the Library and to free up more Reserved_names:



"brings that library into consistency with every other CodeIgniter class. It keeps the architecture consistent and frees up key words for your use. In fact, Controller is likely to change to CI_Controller as well."



The latest build does seem to take the latest CI_Model changes, but nothing for the CI_Controller. Guess we will just have to wait and see....

No comments:

Post a Comment