Closed (fixed)
Project:
Term Merge
Version:
8.x-1.0-alpha2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 May 2018 at 21:45 UTC
Updated:
2 Jul 2020 at 04:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
legolasboHi Matthias,
Thanks for wanting to help out. I'm currently not in a position to work on this myself, but I'll happily accept patches :)
Comment #3
mfrosch commentedHi @legolasbo,
I've took your latest -dev Build from 27 Jun 2018 and added an event.
You find the patch as attachment.
As a helper for those who want to use this event.
You need something like following:
modul_name.services.yml
src/EventSubscriber/SaveSubscriber.php
Comment #4
mfrosch commentedHi @legolasbo,
I guess I was a little bit overhasty.
I already provided my Drupal 8 release of Term Merge Manager and forgot about, that this event isn't even commited. My fault ...
I would be glad if you could apply the patch. :-)
Cheers,
Matthias
Comment #5
legolasboThanks for your contribution @mfrosh.
I've reviewed your patch and found the following issues with it. It also needs test coverage.
What are these? Can you add typehints to them please.
These typehints seem wrong to me :)
Please document these methods. What do they accept and what do they return.
Nitpick: Missing a newline.
Comment #6
mfrosch commentedHi @legolasbo,
thanks for your review.
1. to 3. are done.
But sadly all my tools automatically strips the last new empty line.
E. g. phpStorm or TortoiseGit.
I wasn't able to find a solution on google.
Do you have a hint for me?
Cheers,
Matthias
Comment #8
mfrosch commentedPatch Path Adjustment
Comment #9
legolasboComment #11
mfrosch commentedCoding Standards
Comment #12
mfrosch commentedHi,
I am sorry, I am not able to pass the patch test.
The patch fails because auf trailing whitespaces, but there are no trailing whitespaces.
If i get some hints I will adjust it. Otherwise I would be happy if you apply the patch anyway.
Cheers,
Matthias
Comment #13
mfrosch commentedI did some research, probably it fails because of the windows lineendings. Here is another try.
Comment #15
mfrosch commentedphpstorm file prefix fix
Comment #16
mfrosch commentedHi @legolasbo,
sorry for spamming patches, but I'm happy that I could finally solve this.
Would be happy if could apply the patch.
Cheers,
Matthias
Comment #17
legolasboThis event is fired after terms were already merged. Using these methods can therefore never have any effect, nor are the terms to merge or target term ever retrieved after the event was dispatched. I think they should be removed.
Besides that, I would still like test coverage for this before committing it.
Comment #18
marcoweijenborg commentedTests are added in the attached patch. The setters are removed too. Ready for a new review :)
Comment #19
marcoweijenborg commentedComment #20
legolasboThanks for working on this @marcoweijenborg. I've taken a look at your patch and found the following nitpicks.
Event used to notify subscribers that terms were merged.
These lines can go.
/s/TermMergeEvent/TermsMergedEvent
@var \Drupal\taxonomy\Entity\Term[]
The merge process is nearly completed at this point. All that remains is the removal of the source terms. So let's call this $sourceTerms
$sourceTerms
Retrieve the terms that are being merged into the target term.
getSourceTerms
This comment must end with a '.'
Core uses specific final classes to define and document event names. Let's follow that practice.
See \Drupal\Core\Entity\EntityTypeEvents.
This array should be split over multiple lines.
Namespaced classes should not begin with a file doc comment
Comment #21
marcoweijenborg commentedThe improvements are added to the patch number 21.
Comment #22
marcoweijenborg commentedComment #23
legolasboI another couple of nits to pick, but we're almost there! :)
/s/merge_action/terms_merged
I don't think this comment adds much. Reading the code it's clear that the term merge event is dispatched.
The event dispatcher should be injected through the constructor
I think it would be better to describe what this class does instead of what it is.
Drupal coding standards dictate that each word in a module name starts with a capital
Comment #24
marcoweijenborg commentedOk this should do it :) For some reason, the interdiff couldn't be created, so I only attached the patch.
Comment #25
marcoweijenborg commentedComment #26
marcoweijenborg commentedPatch failed to apply, I attached a new patch.
Comment #27
marcoweijenborg commentedComment #28
mfrosch commentedI've just released a new version 8.x-1.0-beta5 of Term Merge Manager which is compatible with the latest patch from comment #26.
All my tests with this patch works.
Comment #30
legolasboCommitted and pushed to 8.x-1.x-dev. Thanks!