2
$sql = "SELECT * FROM UserWfl ";
$query = $em->createQuery($sql);
$d = $query->getResult();
var_dump($d);

Reference link: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html

error is coming:

[Syntax Error] line 0, col 7: Error: Expected IdentificationVariable | ScalarExpression | AggregateExpression | FunctionDeclaration | PartialObjectExpression | "(" Subselect ")" | CaseExpression, got '*'

Ashfaq
  • 269
  • 2
  • 10

2 Answers2

0

Try this

$sql = "SELECT u FROM UserWfl u";
$query = $em->createQuery($sql);
$d = $query->getResult();
var_dump($d);
Thomas Fritsch
  • 9,639
  • 33
  • 37
  • 49
0

createQuery It is a function for DQL. SQL is different. Doctrine use createNativeQuery function for SQL.

http://www.doctrine-project.org/2009/08/15/doctrine2-native-queries.html for more detail

Ashfaq Muhammad
  • 780
  • 5
  • 10