I want to have Repository class that can execute every 'SELECT' query
that I enter in it, random query from outside.
And I dont want to specify columns that I want to get from this native query.
通常,每个人都会使用以下代码:
$sql = 'select column_one, column_two from table';
$rsm = new ResultSetMapping();
$rsm->addScalarResult('column_one', 'columnOne');
$rsm->addScalarResult('column_two', 'columnTwo');
$query = $this->getEntityManager()->createNativeQuery($sql, $rsm);
$result = $query->getResult();
But in my case I can't specify 'column_one' or 'column_two',
because sql query and columns will be different.
And without $rsm->addScalarResult('column_one', 'columnOne') I don't get any results.
如何在不指定列的情况下获得结果