What’s the difference between getScalarResult and getArrayResult in Doctrine

What’s the difference in using: getScalarResult() and getArrayResult()
when running a query with QueryBuilder in Doctrine:

$query = $this->em->createQueryBuilder();
        $query->select(self::SHORT_LIST)
            ->from(DataSetting::class, 'ds')
            ->andWhere('ds.'.$field.' LIKE :searchField')
            ->setParameter('searchField', $value . '%')
            ->setMaxResults($filters->getLength());
$query->getQuery()->getScalarResult()

and

$query->getQuery()->getArrayResult()

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *