-
Notifications
You must be signed in to change notification settings - Fork 26
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
NEW Update RelatedPages feature for ManyManyThrough #93
NEW Update RelatedPages feature for ManyManyThrough #93
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth noting that this same change has been labelled as an API breakage in core, so we might need to be careful about how we release it. Context: silverstripe/recipe-cms#12. Also the issue is labelled as a patch change, but targets master (next minor release) and has an enhancement prefix on the commit - which should it be (keep in mind previous related issue)
src/Model/RelatedPageLink.php
Outdated
'SortOrder' => DBInt::class | ||
]; | ||
|
||
// For backwards compatibility these must match a traditional 'many_many' definition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use /** */
comment syntax for PHPDocs
57f1fdd
to
68fbede
Compare
OK, so I've refactored a little bit to preserve the existing Since both relationships use the same backing data, hopefully this will see Backwards Compatibility truly maintained. |
This PR requires symbiote/silverstripe-gridfieldextensions#260 right? If so, should we target it at 2.2 as an enhancement? |
In regards to this module, I'd regard it as a bugfix. It requires a fix from a dependency, but I think the constraint already allows for it. Lemme check. The merge for gridfieldextensions was to the master branch, and was a new feature, so will be tagged as So will also need to bump the constraint here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge on green
Composer dependencies don't resolve on travis :( |
I'm aware; should hopefully be a simple matter to resolve - it's more finding the time for a context switch that's preventing this happening quickly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge once CWP 2.1.0 is released, in case it gets merged up and released before then
Thank you for sorting the constraints @robbieaverill ❤️ |
Which also provides the ability to version the relationship.
With the recent update to use ManyManyThroughList instead of the old ManyManyList for the 'RelatedPages' feature on BasePage, this has altered the return type of the applicable getters, and the two types of many many relationship do unfortuantely not implement the same interface. This breaks backwards compatiblity, so this commit in turn attempts to preserve it through keeping both types of relationship. Using the through relationship to maintain the ability to order ones preferences on the related pages list, while keeping the default 'RelatedPages' relationship to return the ManyManyList where anyone might be expecting it. In the background they use the same relationship information, most applicably the same join table that actually defines the relationships through the new SilverStripe 4 feature to be able to custom name a model's database table. This has worked in our advantage by naming the same table as is generated in the old style many_many relationship.
The alterations to support ordering many many through lists in gridfieldextensions will be released as 3.2.0 - the current requirements of cwp/cwp (this module) require ^3.1 - which will pull in the version we need, however it's better to update the minimum version since the update to features here rely upon it. It is improbable yet plausible that someone could end up with an inability to sort their many_many releated pages releationship, which is what parent commits of this one are attempting to prevent.
3429979
to
bd2d911
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased, merge on Travis green (into CWP 2.2 branch since this is marked as an enhancement)
Which also provides the ability to version the relationship.
relies on symbiote/silverstripe-gridfieldextensions#260