/** * @param WorkflowDefinition $workflowDefinition * @param Workflow $workflow */ protected function setEntityAcls(WorkflowDefinition $workflowDefinition, Workflow $workflow) { $entityAcls = array(); foreach ($workflow->getAttributeManager()->getEntityAttributes() as $attribute) { foreach ($workflow->getStepManager()->getSteps() as $step) { $updatable = $attribute->isEntityUpdateAllowed() && $step->isEntityUpdateAllowed($attribute->getName()); $deletable = $attribute->isEntityDeleteAllowed() && $step->isEntityDeleteAllowed($attribute->getName()); if (!$updatable || !$deletable) { $entityAcl = new WorkflowEntityAcl(); $entityAcl->setAttribute($attribute->getName())->setStep($workflowDefinition->getStepByName($step->getName()))->setEntityClass($attribute->getOption('class'))->setUpdatable($updatable)->setDeletable($deletable); $entityAcls[] = $entityAcl; } } } $workflowDefinition->setEntityAcls($entityAcls); }