Closed (fixed)
Project:
Workbench Access
Version:
8.x-1.0-alpha8
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Feb 2018 at 07:33 UTC
Updated:
8 Feb 2023 at 09:16 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
agentrickardMoving to the proper queue.
Comment #3
agentrickardThat code has been removed as part of the refactor, but I don't see that error in Drupal 8.4.4.
That might be a registry cache issue, so try clearing the cache
drush cr.Please make sure that you have followed the update instructions.
https://www.drupal.org/project/workbench_access/releases/8.x-1.0-alpha7
Comment #4
agentrickardComment #5
agentrickardComment #6
bas123 commentedHello,
The error began following a recent Module update to Workbench_access: Version: 8.x-1.0-alpha7
It only appears on the /user/register page.
I just updated Drupal Core to 8.4.5 (following Option #3) and was hoping the error would go away.
Indeed I ran cr
Here is the complete error message:
I hope that helps as I have been looking for a solution everywhere!
Cheers!
Comment #7
bas123 commentedComment #8
agentrickardYou need to run
drush updb --entity-updatesas documented and noted above.Comment #9
JKHendrickson commentedHello,
Like bas123, I ran all of your suggested updates, and still when installing from composer...
"drupal/workbench": "^1.0",
"drupal/workbench_access": "^1.0-alpha8",
"drupal/workbench_moderation": "^1.2",
I get the error message...
"WorkbenchAccessManager does not have a method getDefaultValue" just like bas123.
I'm installing on Drupal 8.5, and I've tried this with both Drush 8, and 9.
Here is the call stack ...
backtrace ... WorkbenchAccessManager.php ln[176]
[559 - 1 - 1520856764.656] : [drush.php 12] drush_main()
--> [preflight.inc 66] Drush\Boot\BaseBoot->bootstrap_and_dispatch()
--> [BaseBoot.php 67] drush_dispatch()
--> [command.inc 199] drush_command()
--> [command.inc 231] _drush_invoke_hooks()
--> [command.inc 422] drush_default_content_deploy_import()
--> [default_content_deploy.drush.inc 212] Drupal\default_content_deploy\Importer->deployContent()
--> [Importer.php 258] Drupal\default_content_deploy\Importer->loadEntityFromJson()
--> [Importer.php 521] Symfony\Component\Serializer\Serializer->deserialize()
--> [Serializer.php 133] Symfony\Component\Serializer\Serializer->denormalize()
--> [Serializer.php 182] Drupal\hal\Normalizer\ContentEntityNormalizer->denormalize()
--> [ContentEntityNormalizer.php 148] Drupal\Core\Entity\EntityStorageBase->create()
--> [EntityStorageBase.php 184] Drupal\Core\Entity\ContentEntityStorageBase->doCreate()
--> [ContentEntityStorageBase.php 79] Drupal\Core\Entity\ContentEntityStorageBase->initFieldValues()
--> [ContentEntityStorageBase.php 137] Drupal\Core\Field\FieldItemList->applyDefaultValue()
--> [FieldItemList.php 169] Drupal\Core\Field\FieldConfigBase->getDefaultValue()
--> [FieldConfigBase.php 396] call_user_func()
--> Drupal\workbench_access\WorkbenchAccessManager::getDefaultValue()
Just for giggles, I put the function :
/**
* {@inheritdoc}
*/
public static function getDefaultValue() {
// JKH this is what was in this function in prev versions...
return array();
}
into the file WorkbenchAccessManager.php and the problem went away.
Is this problem going to be addressed?
Comment #10
agentrickardOnly if it can reliably be duplicated.
Have you run the entity updates as instructed _after_ installing from composer?
Putting that method back is a reliable shim for the issue.
Comment #11
agentrickardHere's the output when I did this via composer following the instructions.
No errors.
That one error is related to #2946766: Error in composer install and only appears when the module has not been configured.
Comment #12
agentrickardOK, I was able to replicate this.
Comment #13
JKHendrickson commentedThanks for the response.
Yes sir, all updates have been applied.
Composer install.
Then from our post installation script.
drush updb --entity-updates -y
I can reproduce this every single time.
getDefaultValue() WorkbenchAccessManager.php ln[166]
My trace from last run where I had put in the "shim" for this.
/**
* {@inheritdoc}
*/
public static function getDefaultValue() {
// JKH this is what was in this function in prev versions...
return array();
}
Are you saying that you will put this back in?
Comment #14
agentrickardThis is a little bit tricky to handle, because DEV is now unstable with more major changes coming, including the removal of the field that is causing the error.
The attached patch will make this specific error go away.
My apologies for the confusion, we have tests for the upgrade path, but they don't cover this instance.
Comment #15
agentrickardAnd a patch which makes existing tests fail.
Comment #16
agentrickardAnd combined for a passing test.
Comment #17
JKHendrickson commentedThank you very much for the quick response!
We have a week or more before we deploy our solution, so we can wait until this patch is in a stable release.
In the meantime the "shim" will allow us to continue development.
Thanks again...
Comment #18
bas123 commentedWell, it appears that there is more to this than I had expected and/or understand.
Ken, I guess I just need a specific PLAN of attack.
If it is spelled out here, I must admit that it is beyond my understanding.
If I am to apply a patch, I believe I have located the instructions on doing that in my terminal, but which one(s)?
Or, as discussed, I am happy to try and restore to version 8.x-1.0-alpha6 , and remove it as was suggested and then install alpha8...
And then start from scratch with the latest version however, I need some specific steps...
ie: I will do the following (Please confirm or modify):
1) Backups
2) Restore the ‘workbench access’ module to version alpha 6 manually
3) Run #drush updb –entity-updates
4) Clear caches etc.
5) Confirm that alpha 6 is running
6) Then I must ask, for your quick instruction for “removing alpha 6 entirely”
a. /admin/modules/uninstall ?
b. Or Drush?
7) Remove any User Account fields for ‘workbench access’ *
8) Install Alpha 8 (via browser, Drush, or Composer)
* And additionally,
I also realized that I now have a “sections” (Taxonomy for Workbench Access) dropdown field listing (what were “University Team” test samples that I converted to suit my needs ) in my posts and articles!
(Image attached)
Will these be affected? And how? (note: I only have one node assigned at this time)!
* Finally, if I simply decided not to reinstall Workbench Access at all, what would be the implications to using the remaining Workbench Modules?
Thoughts?
Comment #19
JKHendrickson commentedbas123, you don't need to go through any of those gyrations to apply the temporary fix.
If you have alpha8 installed, all you have to do is open the PHP file ...
web/modules/contrib/workbench_access/src/WorkbenchAccessManager.php
Scroll to the bottom of the file.
Insert this function into the class.
/**
* {@inheritdoc}
*/
public static function getDefaultValue() {
// JKH this is what was in this function in prev versions...
return array();
}
I think that the author is going to add this function back into his next alpha release.
Until it is released, this shim will work.
Comment #20
agentrickardThe instructions from @JKHenderson are correct. You can either patch workbench_access/src/WorkbenchAccessManager.php manually, or download and apply https://www.drupal.org/files/issues/2018-03-12/2946766-wa-field-test-pas...
patch -p1 < 2946766-wa-field-test-passl.patchfrom the root directory of the workbench_access folder.There is no need to downgrade to alpha6 with this patch.
If you choose to uninstall the module, it will have no effect on the rest of Workbench.
There probably won't be another alpha release. I spent yesterday testing the upgrade path and creating https://github.com/agentrickard/workbench_access/pull/110. The problem is that the current DEV branch contains major changes that mean that we cannot make another release without a major upgrade.
Comment #21
agentrickardComment #25
bas123 commentedThank you BOTH I/we have successfully removed the pecky error!
In as much as I had never used the "patch" process, I wanted to try that method.
Following a video at: https://drupalize.me/videos/applying-and-creating-patches-git?p=1173
Here is my result and a question:
Q1: I am sure there a reason I was not able to 'get' (pardon the pun) status?
ie: "Not a git repository"
Q2: Please point me to my next step toward researching, if you would!
Thanks again!!!
Comment #26
agentrickardThe error means that you are not working with a Git checkout of the code base. So you cannot apply the patch with
git applyUse the more generic command that I pasted above:
Comment #27
JKHendrickson commentedHere are the exact steps that I took to install the patch...
Open terminal window.
Change to the directory where you have workbench_access installed, in my case this was...
web/modules/contrib/workbench_access
Copy or download the file 2946766-wa-field-test-passl.patch to this directory.
Run the command...
patch -p1 < 2946766-wa-field-test-passl.patch
You can also just open the file...
WorkbenchAccessManager.php
and insert this function into the class WorkbenchAccessManager...
/**
* {@inheritdoc}
*/
public static function getDefaultValue() {
return [];
}
This is exactly what the patch does...
Thank you to the author for his support.
Comment #28
bas123 commentedOnce again, I am a bit confused, I have actually removed the error on my development (online) site using the drush and '
# git apply' commands as I described above, however I did get that error. But again, the error on the /user/register page is gone!Should I run the commands described in #16 and #27 over what I have done (in as much as the error has been resolved) to achieve the "Git checkout of the codebase" that you described ?
On my local version, my Aquia Dev Desktop's Drush version will not let me do much especially the 'git' commands, so I applied JKHendrickson's manual insert and that handled it locally!
Thanks again!
Comment #29
agentrickardYou do not want to be managing the workbench_access code with Git from inside the project git repository. That is a complex operation.
Inserting the code manually is fine. The YouTube instructions you found were not appropriate for this situation.
Comment #30
JKHendrickson commentedI agree with the author.
You should look into Composer.
Dependencies in your composer.json file will allow you to download and install contrib modules from their respective sites.
For example in my composer.json file I have the following dependencies that are workbench related...
"drupal/workbench": "^1.0",
"drupal/workbench_access": "^1.0-alpha8",
"drupal/workbench_moderation": "^1.2",
You could put the patch for this in your repo as well (as a temporary solution), and apply the patch as described above as part of your installation script. For example we import content as part of our installation script by executing all of the commands in a file that we call dc.txt.
Sample contents of that file...
drush updb --entity-updates -y
drush cim -y
drush dcdi -y
... your last commands would ...
... change to the directory where you have workbench_access installed.
cd web/modules/contrib/workbench_access
... copy the file 2946766-wa-field-test-passl.patch from where you put it from your git pull.
cp /my/gitplace/2946766-wa-field-test-passl.patch .
... then run the command...
patch -p1 < 2946766-wa-field-test-passl.patch
This is probably outside the scope of this discussion, apologies.
Comment #31
bas123 commentedYou are both quite helpful and I appreciate your having taken the time to help me with this, however apparently I have taken on a bit more that I should have as I am a bit overwhelmed by your explanations..
I do wish to do things correctly however it appears, from all that I can see, that my goal of removing the glaring RED error message has been achieved.
The code:
was inserted into the "WorkbenchAccessManager.php" and the error is gone...
What confuses me is (according to agentrickard), something in the method I used (via the video) was incorrect.
If this will result in problems down the line, I do wish to correct the problem.
So for JKHendrickson, the contents of my composer.json in the '/site/modules/workbench_access/' folder reads:
should be adding:
to that file? By what method would I do that?
Clearly I do not understand the meaning of these codes and/or what they accomplish... I am open to 1) resolving the issue at hand while at the same time 2) learning and understanding how to do this for other modules etc.
Thanks again to you both!
Comment #32
agentrickardIt is asking too much for us to answer your questions about Composer.
See the documentation here for starters -- https://www.drupal.org/docs/develop/using-composer/using-composer-with-d....
This discussion will be irrelevant within a week, however, when beta1 is released and the patch is no longer required.
Comment #33
bas123 commentedOk, fair enough and I have now perused that documentation and do appreciate the value and use of Composer particularly going forward.
Please do answer one question that I am unclear about regarding Composer and Drupal.
When I get messages in my admin reports that Modules etc. are outdated, and then update them and follow through with the database updates via the browser (Command Line), based upon what I have read, am I not using a built in version of Composer to follow all of updates including the dependencies in the json files? Or am I being told that ALL of this needs to be done in a terminal environment?
Further, and to finally clear up the discussion about the workbench access update and patch application, again I still do not know if the procedure I followed (which succeeded in removing the error & applying the patch code) has messed something up elsewhere.
I ask, because I have had some problems with the deployment of some of my backups via Acquia Dev Desktop when I run them locally and am trying to troubleshoot the causes!
These issues began around the time frame of 1) patching the WA Module and 2) Updating Core from 8.3.x to 8.5.0 and don't know if one or both are playing a role in the problems locally!
Thanks!
Comment #34
agentrickardI don't know enough about Composer to answer that question.
As for the update process, that is all a moot point now, as I am about to tag beta1, which eliminates the need for this patch.
It will require another database update, however.
drush updb --entity-updatesor via update.php.Comment #36
nickgee commentedHello,
The getDefaultValue() method is still missing from WorkbenchAccessManager, 8.x-1.0-beta2.
2946766-wa-field-test-passl.patch does not apply cleanly but adding this to the class fixes the issue. (The test part of the patch is already in the code base.)
Thanks!
Comment #37
nor4a commentedProblem still exists. In my case it rises when I try to add a new user in /admin/people/create
So I created the patch to fix this issue for version 2.0.0 also