public function inverseActionValue(OrderedTool $orderedTool, Role $role, $action) { $tool = $orderedTool->getTool(); $maskDecoder = $this->maskManager->getMaskDecoderByToolAndName($tool, $action); $maskValue = $maskDecoder->getValue(); if (!is_null($maskDecoder)) { $rights = $this->toolRightsRepo->findRightsByRoleAndOrderedTool($role, $orderedTool); if (is_null($rights)) { $this->setToolRights($orderedTool, $role, $maskValue); } else { $rightsMask = $rights->getMask() ^ $maskValue; $rights->setMask($rightsMask); $this->om->persist($rights); $this->om->flush(); } } }