How can I set a variable based on the render element $vars[‘body’][‘#object’][‘vid’]? In trying to learn about theming and alter hooks. I'm looking at the render array passed to hook_node_view_alter() with the following code.

function hook_node_view_alter(&amp;$build) {
  dpm($build);
}


I want to set a variable based on $build['body']['#object']['vid']), but I get this error:


  Fatal error: Cannot use object of type stdClass as array


I don't understand this error. Can someone explain it?
The #object in the $build array is an object, therefor it's properties have to be referenced with an arrow, ->

$orig_vid = $build['body']['#object']-&gt;vid;
$build['body']['#object']-&gt;orig_val = $orig_vid;
$build['body']['#object']-&gt;vid = 100;


thanks Gulok for answering this