title: Where to put entity 'helper functions'?
body: <p>I am having trouble understand a key concept of Symfony 2.</p>
  
  <p>I am working on a website where users can create content which then can be sent to other people, using a secret url. Something like www.yoursite.com/{secret-identifier-string}.</p>
  
  <p>I plan on doing this as follows:</p>
  
  <ul>
  <li>Persist the user's content.</li>
  <li>Create the identifier string containing the content id and the creation timestamp (or any other content which will never change again, as extra safety feature) with a two-way encryption method (like <code>mcrypt_encrypt</code>).</li>
  <li>Create the link and display it to the user to give it away</li>
  <li>Whenever a url is called, the identifier string will be decrypted. If the provided timestamp matches the corresponding value of the content id row, the page will be displayed.</li>
  </ul>
  
  <p>My questions are:</p>
  
  <ul>
  <li>Would you consider this a good procedure in general?</li>
  <li>Outside Symfony2 I would create helper methods like <code>getIdentifierString()</code> and <code>getContentPageLink()</code>. Where do I put the corresponding code in Symfony2? Does it belong inside the entity class? If so I am having problems because I am using a service class for encryption. The service is only available in the controller.</li>
  </ul>
  
  <p>Thanks a lot!</p>