Welcome Guest, Not a member yet? Register   Sign In
Meet CodeIgniter MY_Model
#18

(This post was last modified: 03-09-2015, 05:46 AM by spjonez.)

(03-04-2015, 06:57 AM)Avenirer Wrote: Yes... that part is in the works, but I am facing a problem. I already tried to guess the table name from the model name with the help of the method _fetch_table() (if I have User_model, it will guess the table name is users), but when I use that function for finding the fields of the table in the get_fields() method somehow the table name gets the name starting from MY_Model name (if I have a User_model, the table name is guessed to be mies - the plural from My). If you think you could take some time to help me resolve this problem, I would be very happy.

I can't see your full class atm (only partial code in Git?) but do you mean $this->table is using the default value from MY_Model and not the one from your extended model? I had that problem too, not sure why but my construct explore call was doing the same thing. I default to null then only run the explore if it's !== null which fixed it. It shouldn't be doing that so CI must be doing something odd when it instantiates models.

I've fleshed my version out quite a bit, although I now realize I need to use a different deliminator for comment key/val's since validation rules use the same thing haha.

Quote:You should probably change the name and visibility of the $table property.

Meh, personally I don't see the purpose of any of CI's HTML helpers. For the same reason the JS library was deprecated I feel the HTML helpers should be as well. In the rare cases I use a table tag they don't save time since you're using attributes and the methods to use those functions are more verbose then typing it yourself.
Reply


Messages In This Thread
Meet CodeIgniter MY_Model - by Avenirer - 02-20-2015, 02:47 AM
RE: Meet CodeIgniter MY_Model - by Rufnex - 02-20-2015, 03:24 AM
RE: Meet CodeIgniter MY_Model - by spjonez - 02-20-2015, 05:55 AM
RE: Meet CodeIgniter MY_Model - by dmyers - 02-20-2015, 08:58 AM
RE: Meet CodeIgniter MY_Model - by Avenirer - 02-25-2015, 02:50 AM
RE: Meet CodeIgniter MY_Model - by Avenirer - 02-25-2015, 02:52 AM
RE: Meet CodeIgniter MY_Model - by spjonez - 02-25-2015, 05:57 AM
RE: Meet CodeIgniter MY_Model - by Avenirer - 02-25-2015, 06:28 AM
RE: Meet CodeIgniter MY_Model - by spjonez - 02-25-2015, 07:07 PM
RE: Meet CodeIgniter MY_Model - by Avenirer - 02-26-2015, 01:54 AM
RE: Meet CodeIgniter MY_Model - by Avenirer - 02-26-2015, 05:46 AM
RE: Meet CodeIgniter MY_Model - by spjonez - 02-26-2015, 06:55 PM
RE: Meet CodeIgniter MY_Model - by Avenirer - 02-26-2015, 11:51 PM
RE: Meet CodeIgniter MY_Model - by Avenirer - 02-27-2015, 12:35 AM
RE: Meet CodeIgniter MY_Model - by spjonez - 03-03-2015, 04:36 PM
RE: Meet CodeIgniter MY_Model - by Avenirer - 03-04-2015, 06:57 AM
RE: Meet CodeIgniter MY_Model - by mwhitney - 03-06-2015, 11:27 AM
RE: Meet CodeIgniter MY_Model - by spjonez - 03-09-2015, 05:41 AM
RE: Meet CodeIgniter MY_Model - by ivantcholakov - 03-09-2015, 12:52 PM
RE: Meet CodeIgniter MY_Model - by spjonez - 03-11-2015, 06:27 AM
RE: Meet CodeIgniter MY_Model - by san1020 - 03-12-2015, 05:14 AM
RE: Meet CodeIgniter MY_Model - by Avenirer - 03-16-2015, 03:14 AM
RE: Meet CodeIgniter MY_Model - by ircdirk - 03-25-2015, 06:52 AM
RE: Meet CodeIgniter MY_Model - by dgvirtual - 09-25-2016, 01:06 AM
RE: Meet CodeIgniter MY_Model - by Avenirer - 09-27-2016, 11:26 PM
RE: Meet CodeIgniter MY_Model - by dgvirtual - 09-28-2016, 12:00 AM
RE: Meet CodeIgniter MY_Model - by Avenirer - 09-28-2016, 12:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB