Skip to content

Commit d0e43cb

Browse files
authored
Merge pull request #5487 from Laravel-Backpack/fix-json-column-type-infering
Fix json column type infering after removal of dbal
2 parents c2c4847 + 24dfe6e commit d0e43cb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/Library/CrudPanel/Traits/Search.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Backpack\CRUD\ViewNamespaces;
66
use Carbon\Carbon;
7-
use Doctrine\DBAL\Types\JsonType;
87
use Validator;
98

109
trait Search
@@ -113,7 +112,7 @@ public function applyDatatableOrder()
113112
if (method_exists($this->model, 'translationEnabled') &&
114113
$this->model->translationEnabled() &&
115114
$this->model->isTranslatableAttribute($column['name']) &&
116-
is_a($this->model->getConnection()->getDoctrineColumn($this->model->getTableWithPrefix(), $column['name'])->getType(), JsonType::class)
115+
$this->isJsonColumnType($column['name'])
117116
) {
118117
$this->orderByWithPrefix($column['name'].'->'.app()->getLocale(), $column_direction);
119118
} else {
@@ -413,4 +412,9 @@ public function getColumnWithTableNamePrefixed($query, $column)
413412
{
414413
return $query->getModel()->getTable().'.'.$column;
415414
}
415+
416+
private function isJsonColumnType(string $columnName)
417+
{
418+
return $this->model->getDbTableSchema()->getColumnType($columnName) === 'json';
419+
}
416420
}

0 commit comments

Comments
 (0)