title: How to get groups working for JMSSerializerBundle and FOSRestBundle?
body: <p>I am trying to set up different groups to achieve different types of serialization of my entities depending on the context.</p>
  
  <p>My config looks like this:</p>
  
  <pre><code>My\FooBundle\Entity\Asset:
      exclusion_policy: ALL
      access_type: public_method
      properties:
          id:
              access_type: property
              expose: true
              groups: [fnord]
          name:
              expose: true
          path:
              expose: true
          isInQuarantine:
              expose: true
              groups: [baz]
  </code></pre>
  
  <p>I expect that the group having properties should not be exposed unless the group is set.</p>
  
  <p>I am trying to set the group in my controller via:</p>
  
  <pre><code>    $view-&gt;setSerializationContext(SerializationContext::create()-&gt;setGroups(array('fnord')));
  </code></pre>
  
  <p>Yet there is no effect on what is exposed and what isn't. Even if I do not try to change the <code>SerializationContext</code>, the <code>groups</code> options seems to be always ignored.</p>
  
  <p>I know that my config is working because I can toggle the properties via the expose flag.</p>
  
  <p>Yet what am I doing wrong here?</p>