Esempio n. 1
0
 /**
  * Returns an array with all attribute names not used in template
  *
  * We accept Tx_Rnbase_Domain_Model_DataInterface, but the model must also
  * implement IteratorAggregate!
  *
  * @param Tx_Rnbase_Domain_Model_Data $item
  * @param string $template
  * @param string $marker
  * @return array
  */
 public static function findUnusedAttributes(Tx_Rnbase_Domain_Model_DataInterface $item, $template, $marker)
 {
     $ignore = array();
     $minfo = self::containsMarker($template, $marker . '___MINFO');
     $minfoArr = array();
     foreach ($item as $key => $value) {
         if ($minfo) {
             $minfoArr[$key] = $marker . '_' . strtoupper($key);
         }
         if (!self::containsMarker($template, $marker . '_' . strtoupper($key))) {
             $ignore[] = $key;
         }
     }
     if ($minfo) {
         tx_rnbase::load('tx_rnbase_util_Debug');
         $item->setProperty('__MINFO', tx_rnbase_util_Debug::viewArray($minfoArr));
     }
     return $ignore;
 }
 /**
  * Führt vor dem parsen Änderungen am Model durch.
  *
  * @param Tx_Rnbase_Domain_Model_DataInterface $item
  * @param tx_rnbase_configurations &$configurations
  * @param string &$confId
  * @return void
  */
 protected function prepareItem(Tx_Rnbase_Domain_Model_DataInterface $item, tx_rnbase_configurations $configurations, $confId)
 {
     if ($item->isEmpty()) {
         return;
     }
     $dotFieldFields = $configurations->getExploded($confId . 'dataMap.dotFieldFields');
     $dotValueFields = $configurations->getExploded($confId . 'dataMap.dotValueFields');
     $mapFields = array_merge($dotFieldFields, $dotValueFields);
     if (empty($mapFields)) {
         return;
     }
     // wir gehen über alle felder, und ersetzen ggf. enthaltene punkte
     // durch einen unterstrich. Dies ist für den Zugriff über Typoscript notwendig!
     // das gleiche machen wir für kleine werte, diese werden beispielsweise für
     // ein CASE im TS benötigt
     foreach ($mapFields as $field) {
         $newField = '_' . str_replace('.', '_', $field);
         $value = $item->getProperty($field);
         if (in_array($field, $dotFieldFields)) {
             $item->setProperty($newField, $value);
         }
         if (in_array($field, $dotValueFields)) {
             $item->setProperty($newField, str_replace('.', '_', $value));
         }
     }
 }