Following things are changed: (in order of class names)
[shipsimu.git] / inc / classes / main / criteria / class_DataSetCriteria.php
index 7e43565fd0d9a1cdbce270442d027b22f8621fe2..61bdb32596e628db6a0b8aac6b1f237ff1329558 100644 (file)
@@ -38,6 +38,11 @@ class DataSetCriteria extends BaseFrameworkSystem implements StoreableCriteria {
         */
        private $uniqueKey = "";
 
+       /**
+        * Primary key
+        */
+       private $primaryKey = "";
+
        /**
         * Protected constructor
         *
@@ -61,12 +66,16 @@ class DataSetCriteria extends BaseFrameworkSystem implements StoreableCriteria {
        /**
         * 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;
        }
@@ -150,6 +159,34 @@ class DataSetCriteria extends BaseFrameworkSystem implements StoreableCriteria {
        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]