Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Jun 2013 at 14:49 UTC
Updated:
19 Jan 2015 at 13:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
marcingy commentedComment #2
marcingy commentedInitial patch. This doesn't really work - the interface is in place but now vocabularies save but we don't have full objects with names and descriptions etc. Need to dig some more to work out what earth is going on. Note I also had to added some new properties to other interfaces to get tests even to run not sure if we may want to split those elements out?
Comment #4
marcingy commentedOk no local fatals on taxonomy test - still some tests fails and exceptions to fix but hopefully the bot can do a full test. I'll try and fix up the other stuff tomorrow.
Comment #5
marcingy commentedWell that was easier than excepted all taxonomy test are now green locally.
Comment #7
marcingy commentedNew version which hopefully fixes the failures
Comment #9
K.MacKenzie commented#7: vocab-interface-7.patch queued for re-testing.
Comment #10
marcingy commentedThis needs work I just haven't got round to looking at it again - there are a couple of fatals that still need solving.
Comment #11
yesct commented@marcingy is it ok to unassign this until you are ready to restart work on it? Did you have any questions?
Comment #12
daffie commented@marcingy: I think that all the fatals that you had in the summer are now gone. Are you still willing to work on this issue?
Comment #13
marcingy commentedComment #14
andyceo commented7: vocab-interface-7.patch queued for re-testing.
Comment #16
sharique commentedRecreated patch.
Comment #18
izus commented16: vocab-interface-16.patch queued for re-testing.
Comment #20
martin107 commentedThis patch resolved the issue of why testbot fails to install ... nothing more, patches here have never come back green.
I have removed the setUuid() requirement inserted into the the ConfigEntityInterface definition
it is well outside the scope of a taxonomy submodule patch
Specifically the reason it break installation is that it has knock on implications for many entities that extends ConfigEntityBase
The one that install breaks on first is -
Moving to need review just to trigger testbot
Comment #21
filijonka commentedtried to apply this patch and didn't work
Comment #22
martin107 commentedReroll.
Comment #23
martin107 commentedComment #24
msupko commentedComment #25
msupko commentedPrevious patch worked but was following PSR-0. Rerolled for PSR-4 as per instructions here:
https://groups.drupal.org/node/424758
Comment #26
marcingy commentedLooks good to me.
Comment #27
ericduran commentedDo we need the "New" here? I think "setVid" would be ok. Thoughts?
Comment #28
ericduran commentedThere's no setVid so I think it's safe to assume we don't want a setNewVid.
Comment #29
amitgoyal commentedPlease review attached patch for fixes in #27.
Comment #30
andypostI think the proper test here is mark all vocabulary properties as protected
is this really needed?
should be getName() not label()
out of scope
Comment #31
berdirComment #32
undertext commentedComment #34
undertext commentedComment #36
undertext commentedComment #37
sharique commentedI fixed the failing of test, please review.
Comment #40
undertext commentedOh. This one should be green.
Comment #42
undertext commentedComment #43
sharique commented@undertext congratulations. you fixed it.
Comment #44
martin107 commentedI won't advance the status of this issue because I have worked on it..
but here is partial review....
I have had a slow and steady scan of vocab-interface-2030669-42.patch
All changes look appropriate, and are within scope of the issue ... no funny business just changes I would have made so +1 from me.
Comment #45
m1r1k commentedComment #46
dawehnerLet's use @return $this directly.
Afaik we use int instead of integer
let's use $machine_name
Do you have an oppinion of $this->vocabulary->getVid() vs. $this->vocabulary->id() ?
Comment #48
dawehneryeah, I didn't wanted to set it to RTBC directly.
Comment #49
sharique commentedHere is updated patch.
Comment #50
andypostDo we really need this? there's id() and label() already
we should hide the "vid", this is actually setId()
@return $this as said in #46 (1,2)
please do not change that
Comment #51
sharique commentedI did not find setId() function, hence keeping setVid, for the sake of similarity also keeping getVid.
Comment #53
andypost@Sharique please provide interdiff.txt, it's really hard to follow the changes you doing
See https://www.drupal.org/node/1488712
Comment #54
sharique commentedHere is updated patch with interdiff.
Comment #55
sharique commentedAhh, forgot change status again :(
Comment #57
sharique commentedRecreated patch to be able to apply on updated code base.
Comment #59
sharique commentedremoving phpstorm file from patch.
Comment #61
sharique commentedFixing php syntax error.
Comment #63
mile23Reroll of #61.
Comment #64
mile23Comment #66
mile23Fixed TaxonomyPermissions->permissions():
Changed remaining references to ::$name, corrected method documentation.
Comment #68
mile23Woot! Drupal installs now in the testbot. Now to fix the failing tests.
Comment #69
mile23Tests pass locally for me. Trying testbot again.
Comment #72
filijonka commentedremoved some spacing that was added by patch in 66.
and corrected the failures.
bit tired so hopefully didn't mess anything up..
Comment #73
daffie commentedWhy do you want to implement hook_permissions in this patch?
The return value must be set as:
Must be:
Also for the other set value functions.
Comment #74
daffie commentedThe patch is a almost a month old, so also a reroll.
Comment #75
filijonka commentedHi
The hook_permission is introduced in patch #63 so we need an answer by mile23 what is going on there
Comment #76
mile23Oh, that's very strange. Somehow it got inserted in.
Here's just a straight re-roll of #72. Will address the concerns in #73 after the testbot has its say.
Comment #77
mile23Comment #79
mile23Pretty sure the testbot failures are unrelated:
Changes from #73:
Removed
taxonomy_permission().Changed
@return $thisto@return \Drupal\taxonomy\VocabularyInterfacein a few places, plus fixed some indentation errors in that file.set()has a fluent interface, so it's fine to just sayreturn $this->set('something', 'value');. No change.......
Oops. named an interdiff as a patch.
Comment #82
mile23All the fails in #79 (for the patch, not the interdiff) are still related to ContainerAwareEventDispatcherTest, which I'm pretty sure are unrelated to this issue.
Comment #83
daffie commentedIf I understand Mile23 correctly. This issue is to be postponed on issue #2376039: Undefined property ContainerAwareEventDispatcherTest::results in run-tests.sh.
Comment #84
mile23You understand correctly, and thanks for the reference.
Comment #86
mile23The container test issue is fixed, setting to needs review
Comment #88
daffie commentedalexpott reverted the patch for #2376039: Undefined property ContainerAwareEventDispatcherTest::results in run-tests.sh. So putting it back to postponed. Sorry Mile23.
Comment #89
mile23Doh! :-)
Comment #90
daffie commentedFixed again #2376039: Undefined property ContainerAwareEventDispatcherTest::results in run-tests.sh
Comment #93
daffie commentedIn the old patch was the function drupal_ucfirst used. The function has been deprecated.
Comment #94
daffie commentedI have reviewed the patch from #79. I have made some changes to the patch.
- Removed some spaces (to much indentation).
- Minor change to getName() comment.
- In five places I have changed the setVariableName() so that it return $this.
- In the patch the returning value of \Drupal::entityManager()->getStorage('field_storage_config')->loadMultiple($field_ids) is renamed to $fields. It was named $field_storages and everywhere else in drupal it is also called $field_storages. So I changed it back.
Everything else is RTBC for me.
Comment #95
alexpottNone of these have any usages outside of tests therefore we should not be adding them. Use ->set() and ->get() instead.
This is not needed - just use the existing id() method instead.
use ->id()
Comment #96
daffie commentedBravely done what alexpott suggested.
Comment #98
daffie commentedSecond try. Was the tests forgotten.
Comment #99
alexpott@daffie your interdiffs are diffs of diffs. This are interesting but difficult to read :)
For instructions on creating an interdiff, see https://drupal.org/documentation/git/interdiff | Microbranching workflow: http://xjm.drupalgardens.com/blog/interdiffs-how-make-them-and-why-they-...
Comment #100
alexpottThis is unnecessary. The parent class's id method uses voabulary's annotation to get the correct property.
Comment #101
daffie commentedRemoved the function id().
Sorry about the interdiffs. I had some problems with the command. So I thought lets use the diff command then. That one is working for me. Did not know there was a difference. The interdiff command is working now. And I see the difference between the two.
The link to drupalgardens.com gives me an access denied. I probably need to make an account.
But thanks anyway I learned something new. :)
Comment #105
berdir#100 is incorrect, the method is necessary, it already exists and was just moved around (not sure if that is a good idea, as it makes the patch bigger and harder to review).
the id is only automatically detected for content entities at the moment, where we have an automated mechanism that is actually faster than doing it manually.
Comment #106
daffie commented@alexpott: Are you certain that id() can be removed. The patch is failing to test and the only difference with the patch from comment #98 is the removal of the function id(). Or is there something wrong with the testbot?
Comment #107
daffie commented@Bendir: I am not so fast with typing. So I did not read your comment until after I posted comment #106.
Please review the patch from comment #98.
Comment #108
alexpottYep I was wrong. We need the
id()but we shouldn't be moving it. It's a bit annoying that we've got all this info in the entity_keys annotation and then don't use it.Comment #109
daffie commented@alexpott: You have put the status to "needs work". Why?
Comment #110
alexpottBecause we shouldn't be moving the id() method in the Vocabulary class - we can leave it where it was - less to review.
Comment #111
daffie commented@alexpott: The function id() was and is in the Vocabulary class. So where do you want to put the function id() then? Or do you want to add the function id() to ConfigEntityBase class.
Comment #112
berdir@daffie: At the same place inside that file, so that it is not removed and added again in the patch. same for postSave(). It is very hard now to see if postSave() actually changed or not.
Comment #113
daffie commentedThe patch file is now more clear. There are no changes to id() and postSave().
Comment #114
filijonka commentedThere is a change here that I don't think is right, we shuldn't make the protected properties public again just because we remove the get/set functions for them?
Comment #115
daffie commented@filijonka: The whole idea is that the class variables are encapsulated. That means that you must use functions to get or set the variables. And to make sure that you do not access them directly we make them protected.
Comment #116
filijonka commentedyes but in last patch you have made several properties public again which you shouldn't. see #95 number 4.
Comment #117
daffie commented@filijonka: I have looked at my patch again. And I have 5 class variables and they are all protected (vid, name, description, hierarchy and weight).
Comment #118
filijonka commented@daffie I trust you and apologizing, something must be wrong in my browser cause when I make review an patch 113 some says public.. Then at least we are on same page about that.
Comment #119
daffie commented@filijonka: Sorry to hear that you have problems with your browser. Here is a part of the patch:
--- a/core/modules/taxonomy/src/Entity/Vocabulary.php
+++ b/core/modules/taxonomy/src/Entity/Vocabulary.php
@@ -52,21 +52,21 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface {
*
* @var string
*/
- public $vid;
+ protected $vid;
/**
* Name of the vocabulary.
*
* @var string
*/
- public $name;
+ protected $name;
/**
* Description of the vocabulary.
*
* @var string
*/
- public $description;
+ protected $description;
/**
* The type of hierarchy allowed within the vocabulary.
@@ -78,14 +78,51 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface {
*
* @var integer
*/
- public $hierarchy = TAXONOMY_HIERARCHY_DISABLED;
+ protected $hierarchy = TAXONOMY_HIERARCHY_DISABLED;
/**
* The weight of this vocabulary in relation to other vocabularies.
*
* @var integer
*/
- public $weight = 0;
+ protected $weight = 0;
Comment #120
mile23I think the interdiffs are backwards.
Comment #121
daffie commentedPlease use the patch file for the review.
Comment #122
filijonka commentedAs i understand comment #95, if we remove the setX then I would say it's probably safe to remove the getX to. Hence the call for getX in tests should be changed to ->get().
I did a search for getDescription for instance and I couldn't find any outside tests BUT please do one yourself.
Comment #123
filijonka commentedComment #124
daffie commentedThe same as patch #113. Only with the function getDescription() removed.
Comment #126
daffie commentedChanged a description from a taxonomy entity. :(
The same as patch #113. Only with the function getDescription() removed.
Comment #127
filijonka commentedplease always add a interdiff, makes it easier for reviewers.
Comment #128
daffie commented@filijonka: The requested interdiff.
Comment #129
filijonka commented@daffie You should always make an interdiff between each patch. and a patch is preferable to be made from the last one as a startpoint.
Comment #130
daffie commentedComment #131
filijonka commentedSince this is outside a test the call should be as it was $vocabulary->getDescription().
IF a protected property is only accessed in a test and never anywhere else we don't need the get* function but using ->get('propertyname'). But this isn't the case with descriotion.
so this needs to be added again
probably my post that confused about the get function. sorry about that so we can disregard latest patch and go by comment #113.
Comment #132
filijonka commentedI don't like this simply because it's wrong imho. this should just be return $this->propertyname. We don't need to call for another function for that right?
Same goes for the set functions, we don't need to call for another function; just $this->propertyname=parametername, in above case simpy $this->hierarchy = $hierarchy
Comment #133
rpayanmPlease review :)
Comment #138
daffie commentedBetter is "@return $this"
The function setName is only used once. So can we replace it with set('name', $name).
We have a function for this and it is called label(), so can you remove getName(). Change all getName()'s to label().
Why not use label()?
Maybe this is a code improvement, but not necessary for this issue.
Maybe this is a documentation improvement, but not necessary for this issue.
There is a new function called getDescription(). Use it!
Why not use getHierarchy()?
Can be changed to: return $this->hierarchy;
Can be changed to: $this->hierarchy = $hierarchy;
Comment #139
rpayanmwow! thank you :)
Comment #140
daffie commentedAlmost there.
It is getHierarchy().
You can remove this line.
These changes are not necessary for this issue. So please remove them. If you feel they are necessary then create a separate issue for them.
Comment #141
rpayanmI think that alexpott will not commit the last modification, it better a separate issue.
Comment #142
filijonka commentedsee the last block in comment #140
I would also like to know why the comment to the @return should be taken away?
Comment #143
rpayanmI think that alexpott will not commit the last block, it better a separate issue.
Comment #144
daffie commentedI think that we have a misunderstanding. What I want is that you remove a change from your patch. The situation in the file core/modules/taxonomy/src/Form/OverviewTerms.php is without the patch from this issue applied is:
With the patch from comment #141 applied it will become:
The same for change in the file: core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
Situation without the patch applied:
Situation with the patch from comment #141 applied:
Both filijonka and me think that that change will result in:
Hoping that this comment will clear things up. If not then can we chat about this on irc (#drupal-contribute). If I am not there you can also chat with filijonka about this.
Comment #145
rpayanmohhh sorry :(
My english not is so good :)
fixed!
Comment #146
filijonka commentedok looks good now, everything is protected and those that are accessed outside a test have a get/set function.
Comment #147
alexpottThe meta issue has the beta evaluation.
Committed abe83bf and pushed to 8.0.x. Thanks!
Fixed the file modes on commit.