我对 Dql 查询的缓存有问题,我有这 6 行:
$dql = "SELECT d, c FROM \Cms\Day d LEFT JOIN d.contents c WITH c INSTANCE OF Cms\Message ORDER BY d.num ASC";
$query = $this->_em->createQuery($dql);
$result1 = $query->getResult();
$dql = "SELECT d, c FROM \Cms\Day d LEFT JOIN d.contents c WITH c INSTANCE OF Cms\Article ORDER BY d.num ASC";
$query = $this->_em->createQuery($dql);
$result2 = $query->getResult();
我试过了(在 $query->getResult() 之前):
$query->useQueryCache(false);
$query->setQueryCacheLifetime(0);
$query->useResultCache(false);
$query->setQueryCacheDriver(null);
但是我在 $result1 和 $result2 => 中总是有相同的结果 => 有相等并包含第一个查询的结果。
有人能说我怎么解决吗?
谢谢