コード例 #1
0
 public function getAction($name)
 {
     if (!empty($name)) {
         foreach ($this->getConfiguration()->actions->action as $action) {
             if ($action["name"] == $name) {
                 $map = new ActionMapping();
                 try {
                     $map->setInput($action["input"]);
                     $map->setClass($action["class"]);
                     $map->setName($action["name"]);
                     $map->setFormName($action["form"]);
                     if ($this->getForward($action["forward"])) {
                         $map->setForward($this->getForward($action["forward"]));
                     }
                     $map->setPath($action["path"]);
                     $map->setValidate((bool) $action["validate"]);
                     $map->setRoles($action["roles"]);
                     $map->setParameter($action["parameter"]);
                     $forwards = array();
                     foreach ($action->forward as $key => $forward) {
                         $forwards[] = new ActionForward($forward["name"], $forward["path"]);
                     }
                     $map->setForwards($forwards);
                     return $map;
                 } catch (Exception $e) {
                     throw new ConfigurationException("Action: {$action['name']}");
                 }
             }
         }
         throw new ActionNotFoundException("Action: {$name}");
     } else {
         throw new EmptyStringException();
     }
 }