Replace complication and reboot
Posted on 26th Oct 2010 in Random Thoughts
If that fails then replace complication with user first ;)
PHP:
if( is_object( $object_type ) ) | |
{ | |
$_obj = $object_type; | |
} | |
else | |
{ | |
if( !empty( $object_type ) ) | |
{ | |
if( !__autoload( $object_type ) ) | |
{ | |
debug_add( 'Object not available : '.$object_type, array( 'database', 'error' ) ); | |
$object_type = ''; | |
} | |
else | |
{ | |
$_obj = new $object_type(array(), $this->_name ); | |
} | |
} | |
} | |
| |
if( $results = $this->query( $sql, $vars ) ) | |
{ | |
$_results = array(); | |
if( empty( $object_type ) ) | |
{ | |
while( ( $_result = mysql_fetch_object( $results ) ) !== false ) | |
{ | |
$_results[] = $_result; | |
} | |
} | |
else | |
{ | |
while( ( $_result = mysql_fetch_object( $results ) ) !== false ) | |
{ | |
//* | |
if( !empty( $_obj ) ) | |
{ | |
$foo = clone $_obj; | |
$_results[] = $foo->set_from_row( $_result ); | |
unset( $foo ); | |
} | |
else | |
{ | |
//*/ | |
$_results[] = new $object_type( $_result, $this->_name ); | |
} | |
} | |
} |
@link : php.net Clone is my new friend
¥