title: Design pattern to build a GitHub-inspired timeline with relational database?
body: <p>Is there a design pattern for building a GitHub-inspired timeline? I'm trying to write a somewhat complex and versatile timeline system for my application. It is based around this concept: </p>
  
  <pre><code>[Subject] [Verb] [DirectComplement] [IndirectComplement] (metadata: [date])
  </code></pre>
  
  <p>So, in practice:</p>
  
  <pre><code>John created a new post called Beautiful Post (12/01 00:01)
  </code></pre>
  
  <p>John is the subject, created is the verb, Beautiful Post is the direct complement.</p>
  
  <pre><code>John commented "OMG" on Beautiful Post  (12/01 00:00)
  </code></pre>
  
  <p>John is the subject, commented is the verb, "OMG" is the direct complement and Beautiful Post is the indirect complement.</p>
  
  <p>I'm working with Symfony2 and Doctrine, running MySQL. I have created an entity named Timeline which stores, as string, the model of the Subject, DirectComplement and IndirectComplement, as well their IDs. Then, manually, i make the proper queries in order to fetch the objects of each one.</p>
  
  <p>Is there a proper way of doing this with Doctrine and MySQL? A more elegant and versatile approach which does not make me crazy and forcing me to make an absurd amount of queries and foreachs?</p>