title: Doctrine returning datetime object instead of date string, jqGrid jsonmap not working
body: <p>I'm trying to display date in my jqgrid. But doctrine is returning a datetime object instead of a normal string type value which jqgrid can display.</p>
  
  <p>I can think of two possible solutions: </p>
  
  <p>(1) Change doctrine's return type to somehow return a string so that jqgrid can display it without a problem. (Currently the json is returning an object)</p>
  
  <p>(2) Use jsonmap to manipulate the json (The datetime is coming in as an object but it does display proper data inside)</p>
  
  <p>My code:</p>
  
  <p>(Doctrine related)</p>
  
  <pre><code>$qb = $this-&gt;em-&gt;getRepository('ProductOrderLookupBundle:Product')-&gt;createQueryBuilder('u');
  $qb-&gt;select('u.id, u.productName, u.productDetails,u.shipDate, u');
  $qb-&gt;getArrayResult();
  </code></pre>
  
  <p>(Jqgrid related)</p>
  
  <pre><code>jQuery(document).ready(function(){
              jQuery("#list").jqGrid({
                  url:"{{ asset('/app_dev.php/_thrace-datagrid/data/user_management') }}",
                  datatype: 'json',
                  mtype: 'POST',
                  colNames:['Product ID','Product Name', 'Product Details', 'Shipment Date', 'Actions'],
                  colModel :[
                      {name:'id', index:'u.id', width:200},
                  {name:'productName', index:'u.productName', width:200, editable: true},
                  {name:'productDetails', index:'u.productDetails', width:200, align:'right', editable: true},
                  {name:'shipDate', index: 'u.shipDate', editable: true,jsonmap: function (obj) { return getVaueByName(obj.cells, "date"); }},
                  {name:'actions',index:'actions',sortable:false, search:false}
              ],
  other jqgrid related code
  var getVaueByName = function (cells, colName) {
          var i, count = cells.length, item;
          for (i = 0; i &lt; count; i += 1) {
              item = cells[i];
              if (item.colname === colName) {
                  return item.value;
              }
          }
          return '';
      };
  </code></pre>
  
  <p>My json</p>
  
  <pre><code>{
    "page":1,
    "total":20000,
    "records":1000000,
    "rows":
      [
        {"id":1,"cell":[1,"Door","Details",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":2,"cell":[2,"Door2","Details2",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":3,"cell":[3,"Door3","Details3",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":4,"cell":[4,"Door4","Details4",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":5,"cell":[5,"Door5","Details5",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":6,"cell":[6,"Door6","Details6",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":7,"cell":[7,"Door7","Details7",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":8,"cell":[8,"Door8","Details8",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":9,"cell":[9,"Door9","Details9",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]},
        {"id":10,"cell":[10,"Door10","Details10",{"date":"2012-06-18 00:00:00","timezone_type":3,"timezone":"Europe\/Paris"}]}
      ]
  }
  </code></pre>
  
  <p>In this all I want is the value under date column. so far I've tried <a href="https://stackoverflow.com/questions/2690657/mapping-json-data-in-jqgrid">this</a> and <a href="https://stackoverflow.com/questions/8144207/jqgrid-is-it-possible-to-filter-the-value-of-jsonmap-in-colmodel">this</a> . Both are front end related. I have not been able to find doctrine related solutions. I cannot use <code>jsonReader: { repeatitems: false }</code> because it doesn't load my data for some reason.</p>
  
  <p>This is what my current grid looks like
  <img src="https://i.stack.imgur.com/sc5oH.jpg" alt="enter image description here"></p>
  
  <p>Any kind of solution will be appreciated.</p>
  
  <p>Thanks</p>