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

(This post was last modified: 09-27-2016, 11:27 PM by Avenirer.)

(09-25-2016, 01:06 AM)dgvirtual Wrote: Do I understand correctly that My_Model should not be asked to handle relationships on insert or update operations?

Something like

$this->article_model->with_authors()->insert($data);

with_authors() being a many-to-many relationship, and where $data would be all the data of the article, including the author information?

If I am correct, is there a piece of code that could handle such inserts?

MY_Model can be asked whatever you want it to ask, as long as it's not "too applied" to a certain table. If anything is possible, there could be a piece of code that could handle what you asked. The internet is huge. On the other hand, if there isn't, you can create that piece of code and do a pull request on my MY_Model, if you wish to. Or you can use an ORM...

But from your question, what I actually understand is the fact that you think that MY_Model is a paradigm. MY_Model is not a paradigm, it's only a tool that can help you do things faster. For more complex things like what you asked you should simply not use MY_Model's methods, and just get your hands wet with the query builder.
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