title: Doctrine2 Define properties via magic methods
body: <p>Using Doctrine, is it possible to map to properties which don't actually exist using magic methods?</p>
  
  <p>I'm doing the mapping with YAML.</p>
  
  <p>For example, if I wanted to map to a property named "demo", but SomeClass::$demo didn't actually exist. I'd want to some combination of __get(), __set(), __isset() and __call() to handle $demo (and getDemo() and setDemo()) and do something else with them.</p>
  
  <p>I've tried setting this up, but I'm getting an error:</p>
  
  <pre><code>Uncaught exception 'ReflectionException' with message 'Property My\Bundle\DemoBundle\Entity\SomeClass::$demo does not exist'
  </code></pre>
  
  <p>I'm not sure if there is something special with the ReflectionProperty that causes it to miss my magic methods, or if I'm maybe missing a magic function. However, as far as I can tell, ReflectionProperty should interact with them.</p>
  
  <p>Any ideas?</p>
  
  <p>UPDATE:</p>
  
  <p>Upon further investigation, it looks like the ReflectionProperty constructor will throw an exception and won't trigger the magic methods.</p>
  
  <p>Does anyone else know of means to map Doctrine to dynamic properties?</p>
  
  <p>Thanks.</p>
  
  <p>UPDATE 2:</p>
  
  <p>To example what I'm trying to accomplish.</p>
  
  <p>Basically, I have a generic <code>User</code> object which just contains the base properties needed to handle actually being a user (roles, password, salt, username, etc.). However, I want to be able to extend this object to add application-and-user-specific meta data.</p>
  
  <p>So, say I create a Forum bundle. I could then I could dynamically hook up meta data related to the user for use with the Forum. I don't want to put it directly in the User bundle, because then the User bundle becomes less flexible.</p>
  
  <p>If I could somehow dynamically inject new data in to the user, it could all be loaded in a single query with the user, instead of having to be loaded in a separate query. I know there are some other methods to do this, which I've already explored and even used to a limited extend. However, it'd be much nicer if I could dynamically create these associations, which really shouldn't be that difficult of a leap.</p>