pomm-project / Foundation

Foundation package for the Pomm database framework.
MIT License
70 stars 36 forks source link

Register custom converters from a bundle? #127

Closed DjLeChuck closed 6 months ago

DjLeChuck commented 2 years ago

The need

Automatically add custom converters (coming from a bundle) to an existing session (the default of my application).

I don't find a way to achieve this, so I have tried another approach.

Context

Encountered bug

In my application, I don' know why, when I get models of the project, they are randomly attached to the default session or the session add by the bundle (I guess it's not random, but I don't figure out 😄 ). This result in ConverterException like No converter registered for type 'public.validation_type'. when a model use the wrong session.

I don't know if my explanations are clear, so do not hesitate to ask for more details!

The need is the main goal, I do not need this second session, it was only to test an alternative solution because I don't find howto extends the default one through my bundle (I've tried with CompilerPass, but I don't really know where to plug.)

chanmix51 commented 2 years ago

Hello, As far as I can understand, you could not find a way to declare converters you have made in your own bundle into the default Session. So you declared another session then Sf “randomly” switches from a Session to another. It this is your problem, I would advise you to post it on stack-overflow using the pomm tag. If it appears this is related to a bug, then we will open a ticket here.

DjLeChuck commented 2 years ago

That's it! :)

I made the post: https://stackoverflow.com/questions/70166159/register-custom-pomm-converters-from-a-bundle