Hi All,
Could someone tell me whether I’m doing the wrong thing here. I’m trying to use this chap’s CRUD Model;
https://github.com/jamierumbelow/codeigniter-base-model
Is it only for codeigniter? I seem to be hitting all kinds of problems when trying to use in EE 2.4 If it does work, where is it meant to go in the filesystem?
Thanks in advance for any help
Ok, so I found a way to do this. It’s really very handy if you are making a module, despite comments from Boyink
First, plonk MY_Model into system/expressionengine/models - all lower case ‘my_model.php’
Then in system/expressionengine/config/autoload.php, make the following change;
$autoload['model'] = array('my_model');In your third_party module models, simply extend MY_Model instead of CI_Model.
There you have it.
Make sure you specify a protected var of $_table which is of course your table name. There’s actually no need to even declare the constructor, simply the table, and maybe $return_type if you want to return all records as either objects or arrays. Now you’ve got standard CRUD methods to use across multiple models.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.