Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord for CodeIgniter: Rails-style model interactions
#27

[eluser]sophistry[/eluser]
more stuff about PHP4 integration:

according to a comment on the overloading() php.net page referenced earlier you need to return true or false from the constructor otherwise the parser will spit an "unknown method" warning back at you (if your find request doesn't find any data). i modified my constructor from return $result to return true. it probably should return false on some occasion but i'm flying by the seat of my pants here and i really haven't thought it through. this stuff is spinning my head!

"Some useful things to know about overloading:
__call($m,$p,&$r) returns $r back to you, not whatever you put after the keyword return.
What you return determines whether or not the parser consideres the function defined.
__get($var,&$val) returns $val back to you, so fill up $val with what you want then return true or false, same as above."

and regarding my code changes above, i think i misunderstood what was happening with the column name loop in the find_ function. i believe it was a fluke that it worked. it seems that PHP4 overloading also requires the __get() and __set() methods to be defined while PHP5 automatically defines them. so, in PHP4 you can't define an arbitrary class variable without having those __get and __set methods in the class. (i think)

i haven't gotten to the point of adding them, but i wanted to post these few findings first.


Messages In This Thread
ActiveRecord for CodeIgniter: Rails-style model interactions - by El Forum - 09-24-2007, 02:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB