public static function _toArray ($params = array (), $attributes = FALSE, &$db = FALSE)
	{
		
		// If no attributes are set to display, get all class attributes with get allowed
		
		if ($attributes === FALSE)
		{
			
			$attributes	= array ();
			$obj		= new static;
			
			foreach (array_keys (static::$attributes) as $name)
			{
				
				if ($obj->attributeGet ($name))
				{
					$attributes[]	= $name;
				}
				
			}
			
		}
		
		// Select all attributes from the database if none are set
		
		if (!isset ($params['select']))
		{
			$params['select']	= '*';
		}
		
		// Get data
		
		$rows	= static::_getValues ($params, $db);
		
		// If no data was returned return FALSE

		if ($rows === FALSE)
		{
			return FALSE;
		}
		
		// Set array
		
		$arr	= array ();
		
		// For each row
		
		foreach ($rows as $row)
		{

			// Create the sub array
			
			$obj	= array ();

			// Set each attribute

			foreach ($attributes as $name)
			{
				$obj[$name]	= isset ($row[$name])? $row[$name] : NULL;
			}
			
			// Add to main array
			
			$arr[]	= $obj;

		}
		
		// Return array
		
		return $arr;
		
	}
public static function _toArray ($params = array (), $attributes = FALSE, &$db = FALSE)
	{
		
		// If no attributes are set to display, get all class attributes with get allowed
		
		if ($attributes === FALSE)
		{
			
			$attributes	= array ();
			$obj		= new static;
			
			foreach (array_keys (static::$attributes) as $name)
			{
				
				if ($obj->attributeGet ($name))
				{
					$attributes[]	= $name;
				}
				
			}
			
		}
		
		// Select all attributes from the database if none are set
		
		if (!isset ($params['select']))
		{
			$params['select']	= '*';
		}
		
		// Get data
		
		$rows	= static::_getValues ($params, $db);
		
		// If no data was returned return FALSE

		if ($rows === FALSE)
		{
			return FALSE;
		}
		
		// Set array
		
		$arr	= array ();
		
		// For each row
		
		foreach ($rows as $row)
		{

			// Create the sub array
			
			$obj	= array ();

			// Set each attribute

			foreach ($attributes as $name)
			{
				$obj[$name]	= isset ($row[$name])? $row[$name] : NULL;
			}
			
			// Add to main array
			
			$arr[]	= $obj;

		}
		
		// Return array
		
		return $arr;
		
	}
public static function _toArray ( $ params = array ( ) , $ attributes = FALSE , & $ db = FALSE ) { // If no attributes are set to display, get all class attributes with get allowed if ( $ attributes === FALSE ) { $ attributes = array ( ) ; $ obj = new static ; foreach ( array_keys ( static :: $ attributes ) as $ name ) { if ( $ obj -> attributeGet ( $ name ) ) { $ attributes [ ] = $ name ; } } } // Select all attributes from the database if none are set if ( ! isset ( $ params [ 'select' ] ) ) { $ params [ 'select' ] = '*' ; } // Get data $ rows = static :: _getValues ( $ params , $ db ) ; // If no data was returned return FALSE if ( $ rows === FALSE ) { return FALSE ; } // Set array $ arr = array ( ) ; // For each row foreach ( $ rows as $ row ) { // Create the sub array $ obj = array ( ) ; // Set each attribute foreach ( $ attributes as $ name ) { $ obj [ $ name ] = isset ( $ row [ $ name ] ) ? $ row [ $ name ] : NULL ; } // Add to main array $ arr [ ] = $ obj ; } // Return array return $ arr ; }
Return an array with object attributes 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 object|boolean
Return an array with object attributes for given query parameters