title: Is there a way to query if array field contains a certain value in Doctrine2?
body: <p>Starting out with Symfony2 + Doctrine.</p>
  
  <p>I have a table with User objects (fos_user), for which my schema contains a <em>roles</em> column of an <em>'array'</em> type.</p>
  
  <p>Doctrine saves fields of this type by serializing them from php 'array' to 'longtext' (in mysql's case).</p>
  
  <p>So let's say I have the following users saved into DB:</p>
  
  <pre><code>User1: array(ROLE_ADMIN, ROLE_CUSTOM1)
  User2: array(ROLE_ADMIN, ROLE_CUSTOM2)
  User3: array(ROLE_CUSTOM2)
  </code></pre>
  
  <p>Now in my controller I want to select all users with ROLE_ADMIN set. 
  Is there a way to write a DQL query which would directly return me <em>User1</em> and <em>User2</em>?
  Or do I need to fetch all users to have Doctrine to unserialize roles column and then for each of them do <strong>in_array('ROLE_ADMIN', $user->getRoles())</strong>?</p>
  
  <p>I have searched the <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html" rel="noreferrer">DQL part of the manual</a>, but so far did not find anything similar to my needs...</p>
  
  <p><strong>UPD:</strong> Found a <a href="https://stackoverflow.com/questions/9016914/symfony-2-fos-bundle-how-to-select-users-with-a-specific-role">question</a> about the same thing which contains a working query code</p>