title: Symfony2: How to filter the options of an entity-choice form field by a certain attribute?
body: <p><strong>1.) The Situation (simplified)</strong></p>
  
  <p>I have two entities: a Container-entity, which has exactly 1 Content-entity. The content_id is stored in the Container-entity.</p>
  
  <p><strong>2.) Soft-Delete Content-entities</strong></p>
  
  <p>I implemented a function to soft-delete Content-entities, so I added a "deleted"-attribute to the Content-entity. Everything works fine.</p>
  
  <p><strong>3.) The problem</strong></p>
  
  <p>Now, when I want to create a new Container-entity, the auto-generated choices show ALL the Content-entities - even those ones, which I "marked as deleted" (delete-attribute = 1).</p>
  
  <p><strong>4.) The question</strong></p>
  
  <p>Where is the correct place to add a "filter"/"query" to only show the elements which are not marked as deleted? (delete != 1)</p>
  
  <p><strong>5.) What I've tried</strong></p>
  
  <p><strong><em>a.) view/twig approach:</em></strong> I tried to modify the rendering of the {{ form_widget(form.contentId) }} with no success</p>
  
  <p><strong><em>b.) controller approach:</em></strong> I tried to manipulate the form-data in the newAction where the form is being created ($form = $this->createCreateForm($entity)) with no success</p>
  
  <p><strong><em>c.) type/buildForm approach:</em></strong> I tried to change the buildForm()-method ... again, no success</p>
  
  <p>If would be GREAT if you could give me a hint and/or a short code example of where I could hook into the action to remove the soft-deleted choices.</p>
  
  <p>Thank you very much in advance!</p>