Views hook query alter, change the DatabaseCondition Object I am trying to alter views filters with hook_views_query_alter like

function custom_views_query_alter(&amp;$view, &amp;$query) {      
     foreach($query-&gt;where[1]['conditions'] as $idx =&gt; $condition) {
      dpr($condition); 
     } 
}


And below is the output I get from DPR function

Array
(
    [field] =&gt; node.status
    [value] =&gt; 1
    [operator] =&gt; =
)
Array
(
    [field] =&gt; node.type
    [value] =&gt; Array
        (
            [0] =&gt; pricing
        )

    [operator] =&gt; in
)
Array
(
    [field] =&gt; DatabaseCondition Object
        (
            [conditions:protected] =&gt; Array
                (
                    [#conjunction] =&gt; AND
                    [0] =&gt; Array
                        (
                            [field] =&gt; field_data_field_zip_range.field_zip_range_from
                            [value] =&gt; 65000
                            [operator] =&gt; &lt;=
                        )

                    [1] =&gt; Array
                        (
                            [field] =&gt; field_data_field_zip_range.field_zip_range_to
                            [value] =&gt; 65000
                            [operator] =&gt; &gt;=
                        )

                )

            [arguments:protected] =&gt; Array
                (
                )

            [changed:protected] =&gt; 1
            [queryPlaceholderIdentifier:protected] =&gt; 
        )

    [value] =&gt; 
    [operator] =&gt; 
)


So the first 2 filters are not a problem, you just edit the field and you set new values. Problem is the DatabaseCondition Object  with this conditions:protected part. I just don't have a clue how to change values there.

There was similar questions here How to change the query value using hook_views_query_alter?  but it was not solved. It only solves problems for first 2 filters and doesn't do anything for DatabaseCondition Object.
The conditions may be altered by getting them by reference:

function custom_views_query_alter(&amp;$view, &amp;$query) {
   $conditions = &amp;$query-&gt;conditions();
   foreach($conditions as $idx =&gt; $condition) {
     if ($condition['field'] == 'node.type') {
       $conditions[$idx]['value'] = array("Some other type");
     }
   } 
}


Don't forget to modify the object/arrays by reference with the &amp; character.