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

Unable to insert/update array with DBAL functions #14

Open
k0d3r1s opened this issue Jan 25, 2024 · 0 comments
Open

Unable to insert/update array with DBAL functions #14

k0d3r1s opened this issue Jan 25, 2024 · 0 comments

Comments

@k0d3r1s
Copy link
Member

k0d3r1s commented Jan 25, 2024

If database table column has type array (deprecated but possible type) it is impossible to insert/update array into this field.
If database table column has type json, then only way to insert/update data in database, is to switch entity variable type from array to mixed and set data using valid json string instead of array


old:

#[ORM\Column(type: 'json', nullable: true)]
private ?array $data = [];

new:

#[ORM\Column(type: 'json', nullable: true)]
private mixed $data = [];

Edit: null|array|string version seems to break entity mapper, need to use mixed instead

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

1 participant