Sysmfony REST API hash id of entities
<p>I'm building a multitenancy backend using Symfony 2.7.9 with FOSRestBundle and JMSSerializerBundle. </p>

<p>When returning objects over the API, I'd like to hash all the id's of the returned objects, so instead of returning <code>{ id: 5 }</code> it should become something like <code>{ id: 6uPQF1bVzPA }</code> so I can work with the hashed id's in the frontend (maybe by using <a href="http://hashids.org" rel="nofollow">http://hashids.org</a>)</p>

<p>I was thinking about configuring JMSSerializer to set a virtual property (e.g. '_id') on my entities with a custom getter-method that calculates the hash for the id, but I don't have access to the container / to any service.</p>

<p>How could I properly handle this?</p>