/**
  *
  */
 public function testEleminateNonTcaColumns()
 {
     if (tx_rnbase_util_TYPO3::isTYPO60OrHigher()) {
         \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::loadNewTcaColumnsConfigFiles();
     }
     $model = tx_rnbase::makeInstance('tx_mklib_model_WordlistEntry', array());
     $data = array('blacklisted' => true, 'whitelisted' => 0, 'ich-muss-raus' => true, 'ich-auch' => false);
     $res = tx_mklib_util_TCA::eleminateNonTcaColumns($model, $data);
     $this->assertEquals(2, count($res), 'falsche array größe');
     $this->assertTrue($res['blacklisted'], 'blacklsited Feld ist nicht korrekt!');
     $this->assertEquals(0, $res['whitelisted'], 'whitelisted Feld ist nicht korrekt!');
     $this->assertTrue(empty($res['ich-muss-raus']), 'ich-muss-raus Feld wurde nicht entfernt!');
     $this->assertTrue(empty($res['ich-auch']), 'ich-auch Feld wurde nicht entfernt!');
 }
 /**
  * Save model with new data
  *
  * Overwrite this method to specify a specialised method signature,
  * and just call THIS method via parent::handleUpdate().
  * Additionally, the deriving implementation may perform further checks etc.
  *
  * @param tx_rnbase_model_base	$model			This model is being updated.
  * @param array					$data			New data
  * @param string				$where			Override default restriction by defining an explicite where clause
  * @return tx_rnbase_model_base Updated model
  */
 public function handleUpdate(tx_rnbase_model_base $model, array $data, $where = '')
 {
     $table = $model->getTableName();
     $uid = $model->getUid();
     if (!$where) {
         $where = '1=1 AND `' . $table . '`.`uid`=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($uid, $table);
     }
     // remove uid if exists
     if (array_key_exists('uid', $data)) {
         unset($data['uid']);
     }
     // Eleminate columns not in TCA
     tx_rnbase::load('tx_mklib_util_TCA');
     $data = tx_mklib_util_TCA::eleminateNonTcaColumns($model, $data);
     $data = $this->secureFromCrossSiteScripting($model, $data);
     tx_rnbase::load('tx_mklib_util_DB');
     tx_mklib_util_DB::doUpdate($table, $where, $data);
     $model->reset();
     return $model;
 }