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

Doctrine integration #1078

Open
MyZik opened this issue Apr 16, 2020 · 2 comments
Open

Doctrine integration #1078

MyZik opened this issue Apr 16, 2020 · 2 comments
Labels
Projects

Comments

@MyZik
Copy link

MyZik commented Apr 16, 2020

❓ Support Question / Feature Request

Hello!

I would use the Doctrine ORM for our bot package, it would make sense to me, because we can use DB easier. In the end I can create the PR, if my idea sounds okay :)

To do that, I have to solve a problem...

I'm trying to convert the SQL-file to Doctrine Entities. https://github.com/php-telegram-bot/core/blob/master/structure.sql

I need to use command in console:

./vendor/bin/doctrine orm:convert-mapping php src/ --from-database --force

But I've got an error...

Property "chat" in "EditedMessage" was already declared, but it must be declared only once

How can I fix it?

Thank you a lot!

@MyZik MyZik added the question label Apr 16, 2020
@noplanman
Copy link
Member

Seems that having chat_id in multiple foreign keys is the problem here.

There are other errors too after fixing the edited_message table foreign key which I'm busy trying to fix.

@MyZik Have you made any progress on this? I saw your issue at doctrine/orm#8108, but there aren't any solutions there yet either 😕

@noplanman
Copy link
Member

After lots of testing and checking, the problem are the foreign key definitions.
Because we have certain tables that have multiple foreign keys with the same signature (i.e. using the same table-field combinations), Doctrine sees this as a duplicate and therefore throws the error.

Maybe there is a flag for doctrine to ignore such errors?

As far as I can tell, there is nothing we can do, apart from removing those foreign key constraints 😕

@MyZik Have you found some solution for this yet?

@noplanman noplanman added this to Database in v1 Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
v1
Database
Development

No branches or pull requests

2 participants