Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json type throws an error when used with select #545

Closed
ockam opened this issue Mar 14, 2017 · 7 comments
Closed

json type throws an error when used with select #545

ockam opened this issue Mar 14, 2017 · 7 comments

Comments

@ockam
Copy link

ockam commented Mar 14, 2017

I have a table with a json field type.

When trying to access the create form, it throws an error:

Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.

I have narrowed the problem to the fact that I also use a select2 field for another field: the error is triggered by the call to $entity_model::isColumnNullable (even though it’s a simple integer). If I comment the call in select2.blade.php, the error go away and both fields work correctly.

@MarcosBL
Copy link
Contributor

Not sure if Laravel itself manages MySQL 5.7+ field types, if that's the problem. Have you tried to set the column as MEDIUMTEXT ?

Also, look at thjis if you use barryvdh/laravel-ide-helper#295

@ockam
Copy link
Author

ockam commented Mar 14, 2017

Laravel 5.4 allow you to create json fields: doc

I could use TEXT but I want to have the ability to query the jSON field.

@MarcosBL
Copy link
Contributor

Confirmed this myself with Percona fork: 5.7.17-11-log - Percona Server (GPL), Release '11', Revision 'f60191c'

Using a select2 as well, traced to /vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php line 105, at _getPortableTableColumnDefinition : no "json" type there, so not sure if the problem could be DBAL itself: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php#L134

There seems to be a bit of confusion on this on DBAL community doctrine/dbal#2653

@OwenMelbz
Copy link
Contributor

You guys can carry on talking, but I'll close this as it's not a backpack bug it's an issue with Doctrine

If you search the error you'll probably find fixes

@ewiggin
Copy link

ewiggin commented May 25, 2017

the error throwed by isColumnNullable inside the field blade template.

@if ($entity_model::isColumnNullable($field['name']))
            <option value="">-</option>
@endif

@tabacitu
Copy link
Member

@ockam what MySQL version were you running?

@ockam
Copy link
Author

ockam commented May 29, 2017

5.7.17 (on Homestead)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants