jamierumbelow / codeigniter-base-model
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (3)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
MY_Model.php | Fri Dec 18 17:50:35 -0800 2009 | |
| |
README.markdown | Fri Dec 18 05:17:20 -0800 2009 |
codeigniter-base-model
Introduction
This is an extended Model class to use in CodeIgniter applications that provides a base CRUD pattern for your models. It gives you the core CRUD functionality, as well as support for before_create and after_create callbacks and some clever table name guessing.
Usage
Drag the MY_Model.php file into your application/libraries folder. CodeIgniter will load and initialise this class automatically for you. Then all you have to do is make sure all your models extend from MY_Model and all the functionality will be baked into your models automatically!
Naming Conventions
This class will try to guess the name of the table to use, by guessing the plural of the class name. If the table name isn't the plural and you need to set it to something else, just declare the $table instance variable and set it to the table name. Some of the CRUD functions also assume that your primary key ID column is called 'id'. You can overwrite this functionality by setting the $primary_key instance variable.
Upcoming Features
- Support for validations
- Before and after update callbacks
- Better table name guessing
- Better support for associations and JOINs
Version History
- 1.1.1 A limit() method, to allow limiting result sets
- 1.1.0 Two new methods, count_by() and count_all(), made use of some ActiveRecord methods and optimisations
- 1.0.5 Added support for custom primary keys
- 1.0.0 First release
