четверг, 1 ноября 2018 г.

[sylius standalone bundles] "DataSource::__construct() must be an instance of Doctrine\ORM\QueryBuilder, null given" error fix

It means that your Grid repository method doesn't return QueryBuilder, maybe at now you return array/one entity objects with getResult() method inside Repository method.

Example of correct QueryBuilder repository method:

public function createPrivateListQueryBuilder(int $residentId): QueryBuilder{    return $this->createQueryBuilder('a')        ->leftJoin('a.user', 'user')        ->where('user.id = :id')        ->setParameter('id', $residentId);}

Notice that there is no getResult()/getOneOrNullResult()/getSingleResult().
Appears in versions Sylius 1.0 - 1.3, maybe earlier.

Комментариев нет:

Отправить комментарий