Where to register custom doctrine types?

Hi there,

I am programming a custom NextCloud app currently and like to use “enum” as a database type in MySQL. I tried it with dependency injection of the connection in my migration files and tried to register a custom Doctrine type. The problem is, that NextCloud checks all existing tables and if there is a database type it does not know about, it fails. Therefore I like to know, where someone should add the registration of the custom database type so everything works fine. Any ideas?

By the way: I like NextCloud but the documentation is kind of shitty. It is no fun to write an app because you have to check in so many different repositories in GitHub, grep the codebase for tags, when the only thing you want to know is kind of general and basic.

@staff please move this question to /dev/

I guess as early as possible. https://docs.nextcloud.com/server/19/developer_manual/app/bootstrap.html#app-php maybe.

cc @nickvergessen

I’m not aware doctrine supports something like this. Also I’m not aware that enums would be supported on all databases Nextcloud supports, which is why we don’t do this and don’t offer an API for it.

I know that it isn’t supported by all database drivers. My app will only used by the organization I am working for. Therefore it’s okay if only MySQL supports it. Nevertheless: NextCloud uses Doctrine as base for the communication with the database and therefore I know about the AbstractPlatform#registerDoctrineTypeMapping method (https://github.com/doctrine/dbal/blob/76c4c33e0a086dd38c134bab0c6169bb19d86d1c/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php#L403). The only thing I want to know is, if there is any hook that is called before any database check.

Not really, as your app will only be loaded after we loaded from the database which apps we should load.
The link from kesselb is the best you can get

That’s not the answer I was hoping for, but okay. Then I know, that I have to check for the valid values inside my entities.

Thank you :slight_smile: