public function queryResultToArray(QueryResult $queryResult, $fields = 
'bezeichnung', $addemptyoption = true, $emptyoptionname = '') {
                $result = [];
                if ($addemptyoption) $result[0] = $emptyoptionname;
                while ($queryResult->valid()) {
                        $obj = $queryResult->current();
                        if (gettype($fields) == 'array') {
                                $resultString = '';
                                foreach ($fields as $field) {
                                        $method = 'get' . ucfirst($field);
                                        if (method_exists($obj, $method)) {
                                                $resultString .= 
$obj->{$method}() . ', ';
                                        }
                                }
                                $result[$obj->getUid()] = substr($resultString, 
0, -2);
                        } else {
                                $method = 'get' . ucfirst($fields);
                                if (method_exists($obj, $method)) {
                                        $result[$obj->getUid()] = 
$obj->{$method}();
                                }
                        }
                        $queryResult->next();
                }
                return $result;
        }
_______________________________________________
TYPO3-german mailing list
TYPO3-german@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german

Antwort per Email an