APY / APYDataGridBundle

Symfony Datagrid Bundle
MIT License
492 stars 344 forks source link

function lower(uuid) does not exist #1101

Open Jarod-MIDY opened 9 months ago

Jarod-MIDY commented 9 months ago

I was trying to set a permanent filter on a joincolumn, the joined entity uses UUID as primary key.

I encountered 2 problems

First, in APY\DataGridBundle\Grid\Source\Entity, a use APY\DataGridBundle\Grid\Column\JoinColumn; was missing so every if ($variable instanceof JoinColumn) were always false.

Second I now have the following error : An exception occurred while executing a query: SQLSTATE[42883]: Undefined function: 7 ERROR: function lower(uuid) does not exist as if it's trying to lowercase the UUID object coming from my PGSQL DataBase

here is my code

$source = new Entity(Notification::class);
$this->grid->setSource($source);
$this->grid->addColumn(new JoinColumn([
                'id' => 'recipient',
                'title' => 'recipient',
                'field' => "recipient",
                'filterable' => true,
                'sortable' => false,
                'visible' => false,
                'source' => true,
                'columns' => ['id'] //This id is a symfony UUID object
            ]), 0);

$this->grid->setPermanentFilters([
            'recipient' => $user->getId()->__toString(),
        ]);

return $this->grid->getGridResponse($template, $templateParams);