]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/database/wrapper/node/class_NodeListDatabaseWrapper.php
Introduced (currently not used as type-hints) new interfaces:
[hub.git] / application / hub / main / database / wrapper / node / class_NodeListDatabaseWrapper.php
index 4ec539e9c34a41521e9f5e125993dc07a90288a9..6d47114467f1e47fbd64e428efd9665795c2b3e6 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements Registerable {
+class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements NodeListWrapper Registerable {
        // Table names
        const DB_TABLE_NODE_LIST = 'node_list';
 
@@ -183,6 +183,27 @@ class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements Registerabl
                // Run the "INSERT" query
                $this->queryInsertDataSet($dataSetInstance);
        }
+
+       /**
+        * Updates an existing entry in node list
+        *
+        * @param       $messageData            An array of all message data
+        * @param       $handlerInstance        An instance of a HandleableMessage class
+        * @return      void
+        */
+       public function updateNodeByMessageData (array $messageData, HandleableMessage $handlerInstance) {
+               // Get a data set instance
+               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_NODE_LIST));
+
+               // Set primary key (session id)
+               $dataSetInstance->setUniqueKey('node_' . XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID);
+
+               // Add all array elements
+               $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
+
+               // Run the "UPDATE" query
+               $this->queryUpdateDataSet($dataSetInstance);
+       }
 }
 
 // [EOF]