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

Fill in dummy types to deal with DC2:... column comments #102

Merged
merged 4 commits into from
Jan 18, 2024
Merged

Conversation

mpdude
Copy link
Member

@mpdude mpdude commented Jan 18, 2024

We're using the SchemaManager to simplify listing tables, views and so on. But, the information provided by it also includes the DBAL types used for columns, and that information may be parsed from column comments in the database.

The problem is that a table definition like so:

CREATE TABLE `test` (
  `some_col` int NOT NULL COMMENT '(DC2Type:some_type)'
)

... slimdump fail fail with an exception because it does not know about the some_type. This type may be available and defined in your application, but we cannot put it into the slimdump command.

Now, in fact, we don't care about the type and its conversion capabilities at all. So, this PR adds a runtime "just in type" registration of a DummyType that serves as a placeholder to avoid issues when loading the schema.

Fixes #96.

@mpdude mpdude merged commit 02315a3 into master Jan 18, 2024
8 checks passed
@mpdude mpdude deleted the ignore-types branch January 18, 2024 12:44

public function convertToPHPValue($value, AbstractPlatform $platform)
{
throw new LogicException('this should not be called in the first place');
Copy link
Member

@janopae janopae Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could have a better description in this file on why it exists. Maybe these error messages would be a good place for such a description.

It could be something like This Doctrine type assumes that the types won't be used to convert any data – it's just there to allow the rest of DBAL's functionality to work without throwing errors. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

Unable to deal with custom Doctrine types (Case 167398)
2 participants