title: Data Mapper design pattern and many-to-many relationship
body: <p>I've read the following articles about <code>Domain Model</code> design pattern and <code>Data Mapper</code> design pattern:</p>
  
  <ul>
  <li><a href="http://phpmaster.com/building-a-domain-model/" rel="nofollow">http://phpmaster.com/building-a-domain-model/</a></li>
  <li><a href="http://phpmaster.com/integrating-the-data-mappers/" rel="nofollow">http://phpmaster.com/integrating-the-data-mappers/</a></li>
  <li><a href="http://www.devshed.com/c/a/MySQL/Building-an-ORM-in-PHP/" rel="nofollow">http://www.devshed.com/c/a/MySQL/Building-an-ORM-in-PHP/</a></li>
  <li><a href="http://www.devshed.com/c/a/MySQL/Building-an-ORM-in-PHP/1/" rel="nofollow">http://www.devshed.com/c/a/MySQL/Building-an-ORM-in-PHP/1/</a></li>
  </ul>
  
  <p>It's pretty easy for <code>one-to-one</code> relationship. Can anyone explain to me how could I organize <code>many-to-many</code> support?</p>
  
  <p>For example: we have tree tables: <code>posts</code>, <code>images</code> and <code>posts_href_images</code>, where the last table is the table to support <code>many-to-many</code> relationship between posts and images.</p>