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

make:entity platform-specific types, especially jsonb objects #1387

Open
tacman opened this issue Oct 30, 2023 · 0 comments
Open

make:entity platform-specific types, especially jsonb objects #1387

tacman opened this issue Oct 30, 2023 · 0 comments
Labels
Feature New Feature Status: Needs Review Needs to be reviewed

Comments

@tacman
Copy link
Contributor

tacman commented Oct 30, 2023

I'm pleased to see that postgres is the default database for the recipe when installing doctrine-bundle.

JSONB has been available since postgres 9.4, released in 2014. It's hard to imagine why someone would want a larger, slower JSON column. I'd like to propose that when make:entity make it easier (or make it the default) to create JSONB columns.

The easiest way, I think, is when the type is json to always add the

#[ORM\Column(options: ["jsonb" => true])]
private ?array $data = null;

It appears to not have any effect on databases that don't support it, at least SQLite. I'm not sure how MySQL handles it.

Alternatively, the maker could detect the postgres platform and prompt for jsonb.

On a related note, why is the PHP type an array rather than an object? Or both/either? Again, make:entity could add an additional type, json-object, and keep json as an array.

@jrushlow jrushlow added Feature New Feature Status: Needs Review Needs to be reviewed labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Status: Needs Review Needs to be reviewed
Projects
None yet
Development

No branches or pull requests

2 participants