Contao\Database\Result::fetchEach PHP Метод

fetchEach() публичный Метод

Fetch a particular field of each row of the result
public fetchEach ( string $strKey ) : array
$strKey string The field name
Результат array An array of field values
    public function fetchEach($strKey)
    {
        $this->reset();
        $arrReturn = array();
        while (($arrRow = $this->fetchAssoc()) !== false) {
            if ($strKey != 'id' && isset($arrRow['id'])) {
                $arrReturn[$arrRow['id']] = $arrRow[$strKey];
            } else {
                $arrReturn[] = $arrRow[$strKey];
            }
        }
        return $arrReturn;
    }