title: How to persist following associative data to the db using doctrine?
body: <blockquote>
    <p>I use 2 tables.They are shift and fuel issues. Data come from front
    end with association itself.Now I need to send those data to mysql db
    using doctrine.Front end data structure is like following.</p>
  </blockquote>
  
  <pre><code> {
  "commenceTime": "2015-11-06T02:01:12+0000",
  "endTime": "2015-11-06T02:01:12+0000",
  "amountGiven" : 50505,
  "pumperId":2,
  "issuedLooseFuel" : 
      [
          {
              "amount" : 1500.00
          },
          {
              "amount" : 2500.00
          }
      ]
   }
  </code></pre>
  
  <p>now.cleary I want to send shift details as</p>
  
  <pre><code>{"commenceTime": "2015-11-06T02:01:12+0000",
  "endTime": "2015-11-06T02:01:12+0000",
  "amountGiven" : 50505,
  "pumperId":2}
  </code></pre>
  
  <p>and 
  fuel details as =></p>
  
  <pre><code> "issuedLooseFuel" : 
      [
          {
              "amount" : 1500.00
          },
          {
              "amount" : 2500.00
          }
      ]
  </code></pre>
  
  <p>fuel details must be add to the db with references of shift id.</p>
  
  <p>so first must send the shift data and return the shift id and then send the fuel_issue data according to the returned shift ID.
  What is the best practice ?</p>