public static function _arrayToObjects ($arr, $key = FALSE)
	{
		
		// Set object array
		
		$objs	=  new Resource\Model\Collection;
		
		// If no data

		if (!$arr)
		{
			return $objs;
		}
		
		// For each row
		
		foreach ($arr as $row)
		{

			// Create the object

			$obj	= new static;

			// Set each attribute value

			foreach ($row as $name => $val)
			{

				if ($obj->attributeExists ($name))
				{
					$obj->iset ($name, $val, FALSE, TRUE);
				}

			}
			
			// Add to the array
			
			if ($key && isset ($row[$key]))
			{
				$objs[$row[$key]]	= $obj;
			}
			else
			{
				$objs[]	= $obj;
			}

		}
		
		// Return the objects
		
		return $objs;
		
	}
public static function _arrayToObjects ($arr, $key = FALSE)
	{
		
		// Set object array
		
		$objs	=  new Resource\Model\Collection;
		
		// If no data

		if (!$arr)
		{
			return $objs;
		}
		
		// For each row
		
		foreach ($arr as $row)
		{

			// Create the object

			$obj	= new static;

			// Set each attribute value

			foreach ($row as $name => $val)
			{

				if ($obj->attributeExists ($name))
				{
					$obj->iset ($name, $val, FALSE, TRUE);
				}

			}
			
			// Add to the array
			
			if ($key && isset ($row[$key]))
			{
				$objs[$row[$key]]	= $obj;
			}
			else
			{
				$objs[]	= $obj;
			}

		}
		
		// Return the objects
		
		return $objs;
		
	}
public static function _arrayToObjects ( $ arr , $ key = FALSE ) { // Set object array $ objs = new Resource \ Model \ Collection ; // If no data if ( ! $ arr ) { return $ objs ; } // For each row foreach ( $ arr as $ row ) { // Create the object $ obj = new static ; // Set each attribute value foreach ( $ row as $ name => $ val ) { if ( $ obj -> attributeExists ( $ name ) ) { $ obj -> iset ( $ name , $ val , FALSE , TRUE ) ; } } // Add to the array if ( $ key && isset ( $ row [ $ key ] ) ) { $ objs [ $ row [ $ key ] ] = $ obj ; } else { $ objs [ ] = $ obj ; } } // Return the objects return $ objs ; }
Convert an array into objects
@param array $arr Array to convert
@param string $key Attribute value to use as the array index, default to 0-indexed
@return Resource\Model\Collection
Convert an array into objects