Mongodb-odm: Show hint what to add to discriminator map for partial discriminator maps

Created on 12 Jun 2019  路  3Comments  路  Source: doctrine/mongodb-odm

Feature Request

1.3-RC1 introduced deprecation warnings for the upcoming version 2.0. One of them is a warning when a partial discriminator map is found (e.g. here).

As discussed on Slack, , it would be nice if this warning included what should be added to the discriminator map to stay backwards compatible, i.e. it should output the FQCN of the class, exactly what is currently being added automatically. If I have existing documents with the automatically generated discriminators, I have to use the same value, because otherwise those documents would break.

Idea

Most helpful comment

Closing now that we've merged #2064. We've added what we can add without breaking BC. Unfortunately, there are a couple of instances where we can't show you all the info, but in general you should be able to deduce what's going on here.

All 3 comments

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

I finally managed to take a look at this today. The three exception cases all affect the class that is being printed in the deprecation message, or its inheritance chain. Due to the way mapping is set up, we don't know what class defines the discriminator mapping, so it's best to check the class that is printed and go up the inheritance chain if it doesn't have a discriminator map.

While looking at this, I noticed that we didn't change this for one case: associations without a target document can optionally have a discriminator map, which currently can be incomplete. I'll have to add a deprecation warning there as well, but I have to think about how to get full information there. We currently only know the field name of the association, but not the class it's contained in. Since this is public API, I have to find a backwards compatible way of passing the information to the method.

Closing now that we've merged #2064. We've added what we can add without breaking BC. Unfortunately, there are a couple of instances where we can't show you all the info, but in general you should be able to deduce what's going on here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

caiquecastro picture caiquecastro  路  9Comments

atrauzzi picture atrauzzi  路  4Comments

Steveb-p picture Steveb-p  路  10Comments

TheHett picture TheHett  路  5Comments

metanav picture metanav  路  6Comments