Return to Snippet

Revision: 15414
at July 5, 2009 17:07 by madmike


Updated Code
function objectToArray($object, $includes = array()){
	$retArray = array();
	$i = 0;
	foreach($object->all as $o){
		$retArray[$i] = $o->_to_array();
		if(count($includes) > 0){
			foreach($includes as $include){ 
				foreach($o->{$include}->get()->all as $inc){
					$retArray[$i][$include][] = $inc->_to_array();
				}
			}
		}
		++$i;
	}
	
	return $retArray;
}

Revision: 15413
at July 5, 2009 17:07 by madmike


Updated Code
function objectToArray($object, $includes = array()){
	$retArray = array();
	$i = 0;
	foreach($object->all as $o){
		$retArray[$i] = $o->_to_array();
		if(count($includes) > 0){
			foreach($includes as $include){ 
				foreach($o->{$include}->get()->all as $inc){
					echo "k";
					$retArray[$i][$include][] = $inc->_to_array();
				}
			}
		}
		++$i;
	}
	
	return $retArray;
}

Revision: 15412
at July 5, 2009 17:05 by madmike


Initial Code
function objectToArray($object, $includes = array()){
		$retArray = array();
		$i = 0;
		foreach($object->all as $o){
			$retArray[$i] = $o->_to_array();
			if(count($includes) > 0){
				foreach($includes as $include){
					foreach($o->{$include}->get()->all as $inc){
						echo "k";
						$retArray[$i][$include][] = $inc->_to_array();
					}
				}
			}
			++$i;
		}
		
		return $retArray;
	}

Initial URL

                                

Initial Description
coolstuff.

Initial Title
object to array

Initial Tags

                                

Initial Language
PHP