Welcome Guest, Not a member yet? Register   Sign In
How can I write this query with Active Records?
#6

[eluser]Pert[/eluser]
[quote author="behnampmdg3" date="1369431473"]Long story short:
For smaller tables yes. Once you start dealing with larger data, then no.[/quote]

I've started to pre-fetch labels that get used a lot all over the place.

Like get all the statuses and assign them into PHP array using ID as array index:
Code:
$array = array(
'1' => 'Status #1',
'7' => 'Status #7',
'4' => 'Status #4'
);

Then whenever I need to use the text label I can get it with simple <b>$status[$product->status]</b> and you don't need to join tables in your queries. I know joining up few big tables can be hit the memory limit quite easily.


Messages In This Thread
How can I write this query with Active Records? - by El Forum - 05-23-2013, 08:35 PM
How can I write this query with Active Records? - by El Forum - 05-24-2013, 02:13 AM
How can I write this query with Active Records? - by El Forum - 05-24-2013, 05:21 AM
How can I write this query with Active Records? - by El Forum - 05-24-2013, 02:33 PM
How can I write this query with Active Records? - by El Forum - 05-24-2013, 02:37 PM
How can I write this query with Active Records? - by El Forum - 05-29-2013, 01:12 AM
How can I write this query with Active Records? - by El Forum - 05-29-2013, 04:20 AM
How can I write this query with Active Records? - by El Forum - 05-29-2013, 04:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB