Question

As I don't want id values from a select with createQuery, but the select command doesn't allow omitting id (primary key) from the actual query (using "partial") I need to remove the id's from the result from getArrayResult()

No correct solution

OTHER TIPS

I made this small recursive key remover static class:

class arrayTool
{
public static function cleanup($array, $deleteKeys)
{
    foreach($array as $key => $value )
    {
        if(is_array( $value))
        {
            $array[$key] = self::cleanup($array[$key], $deleteKeys);
        } else {
            if (in_array($key, $deleteKeys)) unset($array[$key]);
        }
    }
    return $array;
}
}

Which is called by an array containing one or more keys to be removed from the result, of any array depth:

$array = arrayTool::cleanup($array, array('id', 'id2'));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top