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

[BUGFIX] Fix SubscriberList to Subscriber relationship definition by … #312

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bizmate
Copy link
Contributor

@bizmate bizmate commented Feb 7, 2020

…adding changing invertedBy to mappedBy in Subscriber

Summary

Doctrine bidirectional many to many relationship requires an invertedBy mapping and a mappedBy one.

Fixes validation error as per issue #311

…adding changing invertedBy to mappedBy in Subscriber
Copy link
Contributor

@oliverklee oliverklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Would you mind adding the schema validation as a kind of regression test for this?

@bizmate
Copy link
Contributor Author

bizmate commented Feb 7, 2020

@oliverklee I have added the check but it looks like fixing the validation does not fix all problems. For some reasons doctrine still thinks there is a problem. I think it is the double mapping configuration of the many to many bidirectional relation between SubscriberList and Subscriber.

I am surprised this was never seen before. The nicest approach for the project with version 4 is difficult to achieve without automation, ie

  • in development always use schema tools (ideally not sql) to set and update schema
  • use fixtures for test data instead of sql ( i.e. faker powered fixtures)

As you can see the test is failing. I might check later if I can find a way to make the message
The table with name 'phplist.phplist_listuser' already exists.
go but given my lack of knowledge of the codebase and the manual steps required to run it I might get stuck.
Feel free to let me know your thoughts, also if you have a dev channel like slack or gitter

@bizmate
Copy link
Contributor Author

bizmate commented Feb 7, 2020

https://github.com/phpList/core/blob/master/src/Domain/Model/Subscription/Subscription.php#L23

and

https://github.com/phpList/core/blob/master/src/Domain/Model/Messaging/SubscriberList.php#L118

Are conflicting with each other. The table cannot exist for and entity and at the same time as a many to many mapping. Not sure which one to remove. Also given the integration tests are broken it is also not obvious what to do.

@oliverklee
Copy link
Contributor

oliverklee commented Feb 12, 2020

Are conflicting with each other. The table cannot exist for and entity and at the same time as a many to many mapping. Not sure which one to remove.

In that case, the m:n mapping should be removed (i.e., it should then go through the other model). (I'd like it more though if we could have both.)

Also given the integration tests are broken it is also not obvious what to do.

AFAICT, the tests still are green. Or am I missing something here?
https://travis-ci.org/phpList/core

@oliverklee
Copy link
Contributor

The table with name 'phplist.phplist_listuser' already exists.

That is because currently the phpList 4 core is expected to use an existing phpList 3 database, not create a new database from scratch. (That will come later when phpList 4 is feature-complete enough to be used without phpList 3.)

@oliverklee
Copy link
Contributor

@bizmate By the way, thank you for contributing! I really appreciate your efforts. ❤️

@bizmate
Copy link
Contributor Author

bizmate commented Apr 7, 2020

@oliverklee sorry I was not able to move this further. I wanted to run the travis commands/CI locally and given the repo does not have built in way to do it automatically i was spending time to work how to run the tests correctly on my local machine as I think this might be the reason why I get the errors in the tests. I will try to spend sometime on it ASAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants