Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 3 Model best practices
#1

It's a very first post here so...Hi guys  Big Grin  My name's Jakub (James for friends), I'm using CI from half and past a year, but I need to know some best approach especialy in Model.

Well I'm trying to achieve an OOP principes in Codeigniter, something like ORM but in simpler way. Usually I'm using a simple spl loader in MY_Loader, with my own classess, where properties look like in tables. But the problem are .... relations - espiecially many to many.

For example - I have Database with User($email, $password, $id), Item($name $id) and relation table ($idUser, $idItem).

And now I want to get items what are related to User by item->name. Database makes results by custom_results_object.

Usually I'm just making a several queries to database, table by table, and operate results by standard php methods, to return an array of needed object.

How it's yours idea? I think it's not a good solution to make a several queries, while I can use for example join method. But how to convert it to objects ?
Reply


Messages In This Thread
Codeigniter 3 Model best practices - by LiMingzhe - 07-19-2019, 03:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB