Exemplo n.º 1
0
         if ($policy === null) {
             $policy = $this->policyManager->getPolicy($id);
             $flowScope['isNew'] = false;
             $flowScope["relatedProperties"] = JsonPropertyPrinter::getRelatedFromPolicy($policy);
         }
     }
     /**
      * Put the policy in the flow scope for reference by other states and the views
      */
     $flowScope['policy'] = $policy;
 }
 /**
  * On-exit callback for the "form" state
  * it should take the form submission and deserialize it into a Policy object and
  * stick it on the flowScope.
  *
  * @param $action
  * @param $flowScope
  */
 public function deserializeForm($action, &$flowScope)
 {
     /**
      * @var Policy $policy
      */
     $policy = $flowScope['policy'];
     // Only accept the id if we are creating a new one
     if ($flowScope['isNew']) {
         $policy->id = $this->_getParam('policy_id');
     }
     $policy->setApiIds($this->getSelectedApis());
     $policy->setAuthIds($this->getSelectedAuths());
     $context = $this->getContextAndRates();
     if ($context != null) {
         $contexts[] = $context;
         $policy->setContexts($contexts);
     }
     $policy->headerTransformations = SharedViewUtility::deserializeHeaderTransformations($this->getRequest());
Exemplo n.º 2
0
 /**
  * If no param, returns last error
  * If param is exception, logs exception and sets error
  * If param is String, sets error
  *
  * @static
  * @param null $err
  * @return mixed
  */
 public static function error($err = null)
 {
     if ($err == null) {
         return PolicyManager::$error;
     }
     if ($err instanceof Exception) {
         PolicyManager::$error = $err->getMessage();
         LoggerInterface::logException($err, LoggerInterface::ERROR);
     } else {
         PolicyManager::$error = $err;
         LoggerInterface::log($err, LoggerInterface::ERROR);
     }
 }