Welcome Guest, Not a member yet? Register   Sign In
Nested Query Question (NEWBIE)
#11

[eluser]sl3dg3hamm3r[/eluser]
Sorry, didn't mean to confuse you. "implements Iterator" means you implement the Iterator interface. This has nothing to do with CI and is pure PHP. See [email=http://php.net/manual/en/class.iterator.php]PHP-Manual[/email], or general information about this Pattern [email=http://en.wikipedia.org/wiki/Iterator_pattern]here[/email]. It belongs to the behaviour patterns.
It simply makes it possible to use "foreach" on your class-instance. This wouldn't be possible otherwise.

I'm not sure if you might fetch all data at once with a left-outer join instead of querying each time in getPrice(). You could then simply check there the fields and returning them depending how they are set.

And oh, if it is only about "if field x is null, then take field y", this you actually also could do within SQL-queries. Then the whole design here might be overcomplicated. But I think it is anyhow a good exercise to see how to encapsulate things, right? Smile


Messages In This Thread
Nested Query Question (NEWBIE) - by El Forum - 01-13-2010, 03:49 PM
Nested Query Question (NEWBIE) - by El Forum - 01-13-2010, 04:38 PM
Nested Query Question (NEWBIE) - by El Forum - 01-13-2010, 04:55 PM
Nested Query Question (NEWBIE) - by El Forum - 01-13-2010, 05:26 PM
Nested Query Question (NEWBIE) - by El Forum - 01-13-2010, 11:05 PM
Nested Query Question (NEWBIE) - by El Forum - 01-14-2010, 03:35 AM
Nested Query Question (NEWBIE) - by El Forum - 01-14-2010, 07:12 AM
Nested Query Question (NEWBIE) - by El Forum - 01-14-2010, 08:42 AM
Nested Query Question (NEWBIE) - by El Forum - 01-14-2010, 12:08 PM
Nested Query Question (NEWBIE) - by El Forum - 01-14-2010, 03:08 PM
Nested Query Question (NEWBIE) - by El Forum - 01-15-2010, 03:15 AM
Nested Query Question (NEWBIE) - by El Forum - 01-15-2010, 07:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB