title: MongoDB object mapping (PHP)
body: <p><em>Intoduction problem:</em></p>
  
  <p>What is the best practice to build my <code>class T</code> object, when I receive it from a <code>MongoCursor::getNext()</code>? As far as it goes, <code>getNext()</code> function of a <code>MongoCursor</code> returns with an <code>array</code>. I wish to use the result from that point as an <code>object</code> of type <code>T</code>.</p>
  
  <p>Should I write my own constructor for type <code>T</code>, that accepts an <code>array</code>? Is there any generic solution to this, for example when type <code>T extends G</code>, and <code>G</code> does the job as a regular way, recursively (for nested documents).</p>
  
  <p>I'm new to MongoDB, and I'd like to build my own generic mapper with a nice interface.</p>
  
  <p><em>Bounty:</em></p>
  
  <ul>
  <li>Which are the possible approaches, patterns and which would fit the concept of MongoDB the most from the view of PHP.</li>
  </ul>