0

i am getting a fetchAll when using PHQL.

is there anyway to set it to just a fetch?

$result = $this->modelsManager->executeQuery ( $phql , [ "id" => $id ] );

i have to set the results to: return $result[0];

cheers.

ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
diogenes
  • 1,865
  • 3
  • 24
  • 51

1 Answers1

1

try with:

$phql = "SELECT * FROM \Models\News AS n WHERE n.id = :id:";
$singleResult = $this->modelsManager->executeQuery($phql, ['id' => 3])->getFirst(); 
Nikolay Mihaylov
  • 3,868
  • 8
  • 27
  • 32