Contao\Model\Collection::fetchEach PHP Method

fetchEach() public method

Fetch a column of each row
public fetchEach ( string $strKey ) : array
$strKey string The property name
return array An array with all property values
    public function fetchEach($strKey)
    {
        $this->reset();
        $return = array();
        while ($this->next()) {
            $strPk = $this->current()->getPk();
            if ($strKey != 'id' && isset($this->{$strPk})) {
                $return[$this->{$strPk}] = $this->{$strKey};
            } else {
                $return[] = $this->{$strKey};
            }
        }
        return $return;
    }