Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Advanced Workflow - Error with Silverstripe 3


Go to End


3 Posts   2066 Views

Avatar
Moccy

Community Member, 2 Posts

18 September 2012 at 1:35am

Edited: 18/09/2012 1:37am

Hi all,

I am just upgrading to Silverstripe 3. Everything worked out perfectly, but now I tried to set up the Advanced Workflow module (the current version) which is causing me some trouble. Actually, the installation including dev/build did not bring up any errors or warnings, but when I try to create a new workflow, I always get the following error (captured with FireBug):

ERROR [User Error]: Uncaught Exception: ManyManyList::add() can't be called until a foreign ID is set
IN POST /admin/workflows/WorkflowDefinition/EditForm/field/WorkflowDefinition/item/new/ItemEditForm
Line 76 in /web/XXXXX/htdocs/silverstripe2/framework/model/ManyManyList.php

Source
======
  67:  	 * @param $extraFields A map of additional columns to insert into the joinTable
  68:  	 */
  69:  	function add($item, $extraFields = null) {
  70:  		if(is_numeric($item)) $itemID = $item;
  71:  		else if($item instanceof $this->dataClass) $itemID = $item->ID;
  72:  		else throw new InvalidArgumentException("ManyManyList::add() expecting a $this->dataClass object,
       or ID value", E_USER_ERROR);
  73:  		
  74:  		// Validate foreignID
  75:  		if(!$this->foreignID) {
* 76:  			throw new Exception("ManyManyList::add() can't be called until a foreign ID is set",
       E_USER_WARNING);
  77:  		}
  78:  		
  79:  		// Delete old entries, to prevent duplication
  80:  		$this->removeById($itemID);
  81:  
  82:  		// Insert new entry/entries

Trace
=====
ManyManyList->add(1)
DataList.php:836

DataList->setByIDList(Array)
CheckboxSetField.php:186

CheckboxSetField->saveInto(WorkflowDefinition)
Form.php:1176

Form->saveInto(WorkflowDefinition)
GridFieldDetailForm.php:367

GridFieldDetailForm_ItemRequest->doSave(Array,Form,SS_HTTPRequest)
Form.php:348

Form->httpSubmission(SS_HTTPRequest)
RequestHandler.php:168

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:186

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
GridFieldDetailForm.php:82

GridFieldDetailForm->handleItem(GridField,SS_HTTPRequest)
GridField.php:649

GridField->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:186

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:186

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:149

Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:341

LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:88

AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:281

Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:112

Director::direct(/admin/workflows/WorkflowDefinition/EditForm/field/WorkflowDefinition/item/new/ItemEditForm,DataModel)
main.php:126

Does anyone have a suggestion how to solve this problem? I have not come across any relevant bug ticket.

Thanks a lot in advance,
Moccy

Avatar
Marcus

Administrator, 89 Posts

20 September 2012 at 2:37pm

I'm going to be working with the module a bit later today / tomorrow, so will be able to see a bit more then, but my guess is that you're selecting users/groups when initially creating the workflow? Try creating the definition first, then select users/groups after it's been saved for the first time; this will be changed so you can't perform those actions until after it's saved.

Avatar
Moccy

Community Member, 2 Posts

21 September 2012 at 12:17am

Your guess is right. I now tried to create it without selecting users or groups and it just works... Thank you very much for the workaround!