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

mognodb database name is hardcoded in all Models #296

Open
pkjoshisbp opened this issue Feb 3, 2020 · 4 comments
Open

mognodb database name is hardcoded in all Models #296

pkjoshisbp opened this issue Feb 3, 2020 · 4 comments
Labels
severity:BC breaking Breaks backwards compatibility

Comments

@pkjoshisbp
Copy link

What steps will reproduce the problem?

Generate any model with MongoGii.

What is the expected result?

The model should take only collection name like mysql table. else problem is, if I copy the setup to another instance, I need to manually find and replace all occurrences of database-name. when we are already providing the database name in config, why it needs the db info from model.

What do you get instead?

Additional info

Q A
Yii version 2.0.31
PHP version 7.2.24
Operating system Ubuntu Linux 18.04
@samdark samdark transferred this issue from yiisoft/yii2 Feb 3, 2020
@samdark
Copy link
Member

samdark commented Feb 6, 2020

The solution sounds like the one breaking backwards compatibility. Am I correct? We may do it in 2.2.0.

@pkjoshisbp
Copy link
Author

pkjoshisbp commented Feb 6, 2020

I didn't get what you mean by "breaking backwards compatibility". What I am trying to say is like assume I have one yii2 where I have 50 collections.
I copy the whole yii2 setup for another application for reuse. Now in the new setup the database name is different. Since db-name is included in all the 50 models, I have to replace all occurrences of db-name in all models.
In MySQL model we return only table name, so I think we can use only collection-name for mongodb model.
please let me know if you need any other info.

@samdark
Copy link
Member

samdark commented Feb 6, 2020

"breaking backwards compatibility" means that if we'll replace database name with collection name, existing applications that relied on the old behavior may break.

@pkjoshisbp
Copy link
Author

yes samdark. that is correct. if we change the database name only in config file and don't make change in all models it will break. collection-name remaining same.

@samdark samdark added this to the 2.2.0 milestone Feb 14, 2020
@bizley bizley added the severity:BC breaking Breaks backwards compatibility label Jun 17, 2021
@samdark samdark removed this from the 2.2.0 milestone Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity:BC breaking Breaks backwards compatibility
Projects
None yet
Development

No branches or pull requests

3 participants