I'm trying to mimic this sql query:
$sql = "SELECT *, log.id as logid, date_format(shipdate,'%m/%d/%Y') as shipdate
FROM log LEFT JOIN sub ON sub.id = sub_id
LEFT JOIN main ON id = main_id WHERE
shipdate >= '$datestart' AND shipdate <= '$dateend' ";
When I put SELECT * in the createQuery function of Doctrine, an error says it doesn't recognize that statement so I tried to grab all the entities by selecting individual ones:
$query = $this->getEntityManager()
->createQuery('
SELECT
m.dano, m.partno, m.batchno,
s.rackno, s.heatcode, s.diecode,
l.shipdate, l.qtyshipped, l.blno, l.id as logid
FROM
Bundle:Sub s
JOIN
s.main m
JOIN
s.log l
WHERE
l.shipdate >= :fromdate and l.shipdate <= :todate
')->setParameter('fromdate', $fromdate)
->setParameter('todate', $todate);
However when I do it this way, it doesn't return all the data that the original queries does. It skips some rows. Is there another way to be selecting all the entity?