title: Dependency injection with custom Doctrine 2 data type
body: <p>I have pretty much an identical issue as <a href="https://stackoverflow.com/questions/24330930/dependency-injection-with-custom-doctrine-2-hydrator">Dependency injection with custom Doctrine 2 hydrator</a>, but I need to inject a service into a custom <strong>data type</strong>, not into a hydrator.</p>
  
  <p>The solution in the referenced question is relies on duplicating and modifying doctrine source code as Doctrine initializes the classes itself. Hopefully another approach is viable to custom data types?</p>
  
  <p>This is for a Symfony3 application, if there could be some magic to be applied there.</p>