cvs: pear /Structures_DataGrid/DataGrid DataSource.php
| From: | Olivier Guilyardi | Date: | Tue, 24 Oct 2006 14:07:59 +0000 |
| Subject: | cvs: pear /Structures_DataGrid/DataGrid DataSource.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42785@lists.php.net to get a copy of this message | ||
olivierg Tue Oct 24 14:07:59 2006 UTC
Modified files:
/pear/Structures_DataGrid/DataGrid DataSource.php
Log:
made the primary key an array for effortless support of multiple-fields keys
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/DataSource.php?r1=1.25&r2=1.26&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/DataSource.php
diff -u pear/Structures_DataGrid/DataGrid/DataSource.php:1.25
pear/Structures_DataGrid/DataGrid/DataSource.php:1.26
--- pear/Structures_DataGrid/DataGrid/DataSource.php:1.25 Fri Oct 20 22:57:42 2006
+++ pear/Structures_DataGrid/DataGrid/DataSource.php Tue Oct 24 14:07:58 2006
@@ -22,9 +22,9 @@
* +----------------------------------------------------------------------+
* </pre>
*
- * CSV file id: $Id: DataSource.php,v 1.25 2006/10/20 22:57:42 olivierg Exp $
+ * CSV file id: $Id: DataSource.php,v 1.26 2006/10/24 14:07:58 olivierg Exp $
*
- * @version $Revision: 1.25 $
+ * @version $Revision: 1.26 $
* @package Structures_DataGrid
* @category Structures
*/
@@ -45,8 +45,10 @@
* when 'generate_columns' is true.
* Form: array(field => label, ...)
* (default: array())
- * - primary_key (string) Name (or numerical index) of the field that
- * contains a unique record identifier
+ * - primary_key (array) Name(s), or numerical index(es) of the
+ * field(s) which contain a unique record
+ * identifier (only use several fields in case
+ * of a multiple-fields primary key)
*
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Andrew Nagy <asnagy@webitecture.org>
@@ -290,13 +292,17 @@
}
/**
- * Return the primary key field name or numerical index
+ * Return the primary key specification
+ *
+ * This method always return an array containing:
+ * - either one field name or index in case of a single-field key
+ * - or several field names or indexes in case of a multiple-fields key
*
* Drivers that support the "writeMode" feature should overload this method
* if the key can be detected. However, the detection must not override the
* "primary_key" option.
*
- * @return string Field name or numerical index
+ * @return array Field(s) name(s) or numerical index(es)
* @access protected
*/
function getPrimaryKey()
@@ -313,7 +319,7 @@
* object on failure.
*
* @abstract
- * @param string $key Unique record identifier
+ * @param array $key Unique record identifier
* @param array $data Associative array of the form:
* array(field => value, ..)
* @return object PEAR_Error with message
@@ -336,7 +342,7 @@
* object on failure.
*
* @abstract
- * @param string $key Unique record identifier
+ * @param array $key Unique record identifier
* @return object PEAR_Error with message
* "No data source driver loaded or write mode
* not supported by the current driver"