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()

没有正确的解决方案

其他提示

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'));
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top