title: Symfony2 global functions
body: <p>For example i have algorithmic function, which calculates specific hash-code. Function itself is 300+ lines of code. I need to use that functions many times in many different controllers in my bundle. Where can i store my <code>calculate_hash()</code> to use it in my bundle ? Can i access it from other bundles ? 
  Can i also write global <code>calculate_hash()</code> which have access to <strong>entity manager</strong> ? </p>
  
  <p>Didn't find my answer <a href="http://symfony.com/doc/current/cookbook/bundles/best_practices.html">here</a>.</p>