*/
private $uniqueKey = "";
+ /**
+ * Primary key
+ */
+ private $primaryKey = "";
+
/**
* Protected constructor
*
/**
* Creates an instance of this criteria
*
- * @return $criteriaInstance An instance of this criteria
+ * @param $tableName Name of the table
+ * @return $criteriaInstance An instance of this criteria
*/
- public final static function createDataSetCriteria () {
+ public final static function createDataSetCriteria ($tableName) {
// Get a new instance
$criteriaInstance = new DataSetCriteria();
+ // Set table name
+ $criteriaInstance->setTableName($tableName);
+
// Return the instance
return $criteriaInstance;
}
public final function getCriteriaArray () {
return $this->tableColumns;
}
+
+ /**
+ * Getter for primary key or unique key if not set
+ *
+ * @return $primaryKey Primary key or unique key if not set
+ */
+ public final function getPrimaryKey () {
+ // Get primary key by default
+ $primaryKey = $this->primaryKey;
+
+ if (empty($primaryKey)) {
+ // Get uniqueKey
+ $primaryKey = $this->getUniqueKey();
+ } // END - if
+
+ // Return it
+ return $primaryKey;
+ }
+
+ /**
+ * Setter for primary key
+ *
+ * @param $primaryKey Primary key to set
+ * @return void
+ */
+ public final function setPrimaryKey ($primaryKey) {
+ $this->primaryKey = (string) $primaryKey;
+ }
}
// [EOF]