Re: Casting objects.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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_object,
> but odbc_fetch_assoc and then iterate the array and populate a new
> structuresRemovalReason.
> 
> Or an I missing a trick. I'm pretty sure I am.
> 
> Regards,
> 
> Richard Quadling.
> 

Something like this in your class or another class may work (not
tested).  You might even fetch an array and send it to this method.  I
think either should work:

class structuresRemovalReason {

    static public function cast(structuresRemovalReason $object) {
        return $object;
    }
}

$row = structuresRemovalReason::cast(odbc_fetch_object($result));

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux