Problem/Motivation
The module currently uses terminology that is different from other modules using similar concepts like redirect/migrate. We are using target/referenced and referencing/host instead of source/destination. This makes it harder to grasp what you need when working with the module.
Proposed resolution
Use source/destination instead of target/referenced and referencing/host.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff-6-10.txt | 19.02 KB | seanb |
| #10 | 2951584-10-2.x-do-not-test.patch | 85.54 KB | seanb |
| #10 | 2951584-10-full-1.x.patch | 96.3 KB | seanb |
| #9 | 2951584-9-1.x-full.patch | 94.35 KB | marcoscano |
| #9 | interdiff-6-9.txt | 1.39 KB | marcoscano |
Comments
Comment #2
bryandenijsIs 'destination' the best solution? I think 'target' fits better (target_id).
Comment #3
marcoscanoYeah, I kinda like source/target better too, but don't really feel strong about it, as long as we use whatever we choose consistently everywhere.
Comment #4
seanbNow I'm thinking about it, let's go with target then. Destination makes sense for redirects and migrations but in our case it's a little different.
Here is a patch to change the terminology and fix a whole bunch of nits (updated docs, removed newlines, small coding standard things).
Comment #6
seanbSmall failures were expected. Tests+++++
Let's try again..
Comment #8
marcoscano@seanB amazing work! Thanks a lot!!
Once I hadn't reviewed the fieldname modifs, I've gone over the full patch.
I would enforce this to be not null. Any scenario where it could not be the case?
Can we rename this hook to 8201?
Also, even if we are not offering BC, sites with existing data shouldn't lose the statistics they already have. Once our data can always be recalculated, I believe the easiest thing to do here is to just trigger a bulk update after re-creating the table with the new schema.
Thanks! :)
In the origin of times, entity_reference was the only tracking method available, so it kind of made sense to call the method without this parameter. Nowadays I wonder if we shouldn't just make it required with no default value.
I'm thinking about the fact that by adding the field name to the schema, now all rows will be unique except for the amount of "usages" in the same field.
Regardless if we track all usages of the same entity inside the same field or not (we probably want to improve that in the future), maybe it could make sense to simplify the API and replace both
add()anddelete()methods by a singleregister()method that would always write the count to the row, and delete the row if called with count 0?If we do the above unifying the method to write to the database, we should also change the events to something like
USAGE_TRACK(when registering a count > 0) andUSAGE_DELETEwhen registering a count = 0 (deleting a row).Originally the
listUsage()was named like this to make an analogy to file usage in core, that is called the same.At this point I wonder though if it wouldn't make more sense to call these two methods
listSources($target_entity)andlistTargets($source_entity... Thoughts?If the schema for this is not null, in what circumstances this could be empty? Maybe it's good to let it break here, once it would mean something is wrong?
Yeah, this definitely will get hairy as we start adding more info to the array... :) Not sure though an easy way to simplify and also have a single method capable of getting all information. But I think we can leave this improvement for a later iteration in any case.
Maybe a better description for this could be
?
In this particular case I believe the replacement is not ideal... Maybe
The method used to relate source with targetwould result clearer?idem
maybe just
setMethoddirectly?same here
Again, if we set the schema to not null we should update this.
if we changed above we'll need to update here too.
Comment #9
marcoscanoThat's a weird failure, sometimes just re-triggering the test on the testbot makes it green :/
In my local it passes as is, but let's see if these apparently unrelated changes make any change with the bot.
Comment #10
seanbThanks for the review! Not sure what's wrong with the test, it passes for me locally?
1. Done
2. Done
3. :)
4. Done
5. Let's do this in a followup
6. Let's do this in a followup
7. Agreed, changed it.
8. Done. I did that for BC when I wrote it, but then stuff happened and this no longer makes sense.
9. Yes, let's do that in a followup.
10. Done
11. Done
12. Done
13. Done
14. Done
15. Actual
Comment #11
marcoscanoThanks!
+1 to move on with the next steps, given no new relevant test failures appear (it shouldn't).
For the record, things I think we should keep track for doing in follow-ups:
- Trigger the bulk-update after the update hook has recreated the table
- Unify the add/remove methods (and adjusting the events)
- Try to simplify the array-of-doom being returned from
::listSources()Comment #13
marcoscanoNot sure what's wrong with the bot... it's running all core tests instead of ours?
Comment #14
seanbCommitted to 2.x unstable since the test pass locally for me.
Comment #18
seanb@marcoscano
- Try to simplify the array-of-doom is being done as part of (really needed it there) #2922418: Refactor multilingual tracking
If needed can you create followups for the other issues and close this one?
Comment #19
marcoscanoFollow-ups created and added to the roadmap.
Thanks!
Comment #21
marcoscano