public static function _toXML ($params = array (), $attributes = FALSE, &$db = FALSE)
	{
		
		// Set class name for the elements
		// Remove the Sonic\Model prefix and convert namespace \ to _
		
		$class	= str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
		
		// Create DOMDocument

		$doc	= new \DOMDocument ('1.0', 'UTF-8');
		
		// Create root node
		
		$xml	= $doc->createElement ('elements');
		$doc->appendChild ($xml);
		
		// Get objects
		
		$rows	= static::_toArray ($params, $attributes, $db);
		
		// For each row
		
		foreach ($rows as $row)
		{

			// Create the node

			$node	= $doc->createElement ($class);

			// Set each attribute

			foreach ($row as $name => $val)
			{
				$node->appendChild ($doc->createElement (strtolower ($name), htmlentities ($val)));
			}
			
			// Add node

			$xml->appendChild ($node);

		}
		
		// Return doc
		
		return $doc;
		
	}
public static function _toXML ($params = array (), $attributes = FALSE, &$db = FALSE)
	{
		
		// Set class name for the elements
		// Remove the Sonic\Model prefix and convert namespace \ to _
		
		$class	= str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
		
		// Create DOMDocument

		$doc	= new \DOMDocument ('1.0', 'UTF-8');
		
		// Create root node
		
		$xml	= $doc->createElement ('elements');
		$doc->appendChild ($xml);
		
		// Get objects
		
		$rows	= static::_toArray ($params, $attributes, $db);
		
		// For each row
		
		foreach ($rows as $row)
		{

			// Create the node

			$node	= $doc->createElement ($class);

			// Set each attribute

			foreach ($row as $name => $val)
			{
				$node->appendChild ($doc->createElement (strtolower ($name), htmlentities ($val)));
			}
			
			// Add node

			$xml->appendChild ($node);

		}
		
		// Return doc
		
		return $doc;
		
	}
public static function _toXML ( $ params = array ( ) , $ attributes = FALSE , & $ db = FALSE ) { // Set class name for the elements // Remove the Sonic\Model prefix and convert namespace \ to _ $ class = str_replace ( '\\' , '_' , str_replace ( 'sonic\\model\\' , '' , strtolower ( get_called_class ( ) ) ) ) ; // Create DOMDocument $ doc = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; // Create root node $ xml = $ doc -> createElement ( 'elements' ) ; $ doc -> appendChild ( $ xml ) ; // Get objects $ rows = static :: _toArray ( $ params , $ attributes , $ db ) ; // For each row foreach ( $ rows as $ row ) { // Create the node $ node = $ doc -> createElement ( $ class ) ; // Set each attribute foreach ( $ row as $ name => $ val ) { $ node -> appendChild ( $ doc -> createElement ( strtolower ( $ name ) , htmlentities ( $ val ) ) ) ; } // Add node $ xml -> appendChild ( $ node ) ; } // Return doc return $ doc ; }
Return a DOM tree with objects for given query parameters
@param array $params Parameter array
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param \PDO $db Database connection to use
@return \DOMDocument|boolean
Return a DOM tree with objects for given query parameters