[eluser]Rey Philip Regis[/eluser]
Hi guys,
Here I am again asking questions haha....Well actually What Im going to ask is not about syntax for code igniter. Actually I can ask this question other php framework communities like Zend, CakePHP and others, but since Im here in the CodeIgniter community and Im now learning how to code using CodeIgniter and I stayed here cause Im very comfortable using it, so I planned to asked the expert coders here.
Im going to ask about the "M" on the M-V-C which is the model. Is it advisable to have a model using joins?
Sample:
category_table
id | category_name
1 | cellphone
2 | processors
3 | speakers
4 | monitors
products_table
id | category_id | product_name
1 | 1 | nokia N96
2 | 1 | nokia N81
3 | 2 | intel quadcore 2.4
4 | 2 | amd phenom
5 | 3 | altec lansing VS4221
6 | 3 | creative inspire 2.1
7 | 4 | LG Flatron L17753S
8 | 4 | Samsung T220
Now....What I want to do is that I want to have an output like this
category_name | product_name
cellphone | nokia N96
cellphone | nokia N81
processors | intel quadcore 2.4
processors | amd phenom
speakers | altec lansing VS4221
speakers | creative inspire 2.1
monitors | LG Flatron L17753S
monitors | Samsung T220
So, if Im going to have this output, I will do a join syntax in SQL.
My question now is this, is it advisable to have a model using join?
And if its okey (meaning advisable) what is the name of the model product_category_model?
I need an advise from the experts. Cause Ive seen in other frameworks that models only maps
one table, so for example categiry_table so you will have a category_table class "Model".
So how about my scenario?
Thanks in advance.....
Good day.