Updating object properties in twig

You can do it by merging objects:

{% set object = object|merge({'property1': 'somenewvalue'}) %}

Twig has a do tag that allows you to do that.

{% do foo.setBar(value) %}

A possible way to set a property is to create a method in the object which actually creates new properties:

class Get extends StdClass 
  {

    protected function setProperty($name,$value = null)
    {
    $this->$name = $value;
    }

  }