| @@ 932-955 (lines=24) @@ | ||
| 929 | /** |
|
| 930 | * @Assert\Callback() |
|
| 931 | */ |
|
| 932 | public function isSchemesValueAllowed(ExecutionContextInterface $context) |
|
| 933 | { |
|
| 934 | $serviceManager = ServiceUtil::getManager(); |
|
| 935 | $helper = $serviceManager->get('zikula_routes_module.listentries_helper'); |
|
| 936 | $listEntries = $helper->getSchemesEntriesForRoute(); |
|
| 937 | $dom = ZLanguage::getModuleDomain('ZikulaRoutesModule'); |
|
| 938 | ||
| 939 | $allowedValues = []; |
|
| 940 | foreach ($listEntries as $entry) { |
|
| 941 | $allowedValues[] = $entry['value']; |
|
| 942 | } |
|
| 943 | ||
| 944 | $selected = explode('###', $this->schemes); |
|
| 945 | foreach ($selected as $value) { |
|
| 946 | if ($value == '') { |
|
| 947 | continue; |
|
| 948 | } |
|
| 949 | if (!in_array($value, $allowedValues, true)) { |
|
| 950 | $context->buildViolation(__('Invalid value provided', $dom)) |
|
| 951 | ->atPath('schemes') |
|
| 952 | ->addViolation(); |
|
| 953 | } |
|
| 954 | } |
|
| 955 | } |
|
| 956 | ||
| 957 | /** |
|
| 958 | * @Assert\Callback() |
|
| @@ 960-983 (lines=24) @@ | ||
| 957 | /** |
|
| 958 | * @Assert\Callback() |
|
| 959 | */ |
|
| 960 | public function isMethodsValueAllowed(ExecutionContextInterface $context) |
|
| 961 | { |
|
| 962 | $serviceManager = ServiceUtil::getManager(); |
|
| 963 | $helper = $serviceManager->get('zikula_routes_module.listentries_helper'); |
|
| 964 | $listEntries = $helper->getMethodsEntriesForRoute(); |
|
| 965 | $dom = ZLanguage::getModuleDomain('ZikulaRoutesModule'); |
|
| 966 | ||
| 967 | $allowedValues = []; |
|
| 968 | foreach ($listEntries as $entry) { |
|
| 969 | $allowedValues[] = $entry['value']; |
|
| 970 | } |
|
| 971 | ||
| 972 | $selected = explode('###', $this->methods); |
|
| 973 | foreach ($selected as $value) { |
|
| 974 | if ($value == '') { |
|
| 975 | continue; |
|
| 976 | } |
|
| 977 | if (!in_array($value, $allowedValues, true)) { |
|
| 978 | $context->buildViolation(__('Invalid value provided', $dom)) |
|
| 979 | ->atPath('methods') |
|
| 980 | ->addViolation(); |
|
| 981 | } |
|
| 982 | } |
|
| 983 | } |
|
| 984 | ||
| 985 | /** |
|
| 986 | * Sets/retrieves the workflow details. |
|