Показаны сообщения с ярлыком grid. Показать все сообщения
Показаны сообщения с ярлыком grid. Показать все сообщения

четверг, 28 марта 2019 г.

sylius grid 'sorting' doesnt work fix

make your needed field for sorting `sortable: true` in `fields:` definition, for example:

sylius_grid:
    grids:
        my_grid:
            driver:
                name: doctrine/orm
                options:
                    class: App\Document\Record
            sorting:
                datetime: desc
            fields:
                datetime:
                    type: datetime
                    sortable: true

четверг, 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.