[PHP] Re: Casting objects.

2010-01-19 Thread Carlos Medina
Richard Quadling schrieb: 2010/1/18 Shawn McKenzie : Shawn McKenzie wrote: Never mind, that was stupid. I saw that somewhere before, but obviously it doesn't work. I found some code, maybe I redeem myself? static public function cast(&$object, $class=__CLASS__){ if(class_exists($clas

[PHP] Re: Casting objects.

2010-01-19 Thread Richard Quadling
2010/1/18 Shawn McKenzie : > Shawn McKenzie wrote: >>> >> Never mind, that was stupid. I saw that somewhere before, but obviously >> it doesn't work. >> > > I found some code, maybe I redeem myself? > > static public function cast(&$object, $class=__CLASS__){ > >        if(class_exists($class)) { >

[PHP] Re: Casting objects.

2010-01-18 Thread Shawn McKenzie
Shawn McKenzie wrote: >> > Never mind, that was stupid. I saw that somewhere before, but obviously > it doesn't work. > I found some code, maybe I redeem myself? static public function cast(&$object, $class=__CLASS__){ if(class_exists($class)) { $object = unserialize(

[PHP] Re: Casting objects.

2010-01-18 Thread Shawn McKenzie
Shawn McKenzie wrote: > Richard Quadling wrote: >> Hello. >> >> I've got an object via odbc_fetch_object (which is of stdClass). >> >> I have an class structuresRemovalReason. >> >> I want to cast the response of odbc_fetch_object to structuresRemovalReason. >> >> The only way I can see of doing th

[PHP] Re: Casting objects.

2010-01-18 Thread Shawn McKenzie
Richard Quadling wrote: > Hello. > > I've got an object via odbc_fetch_object (which is of stdClass). > > I have an class structuresRemovalReason. > > I want to cast the response of odbc_fetch_object to structuresRemovalReason. > > The only way I can see of doing this is to not use odbc_fetch_o