getVars() public method

Returns the array of templates variables.
public getVars ( ) : array
return array
コード例 #1
0
ファイル: TemplateListener.php プロジェクト: baurat/Schulapp
 /**
  * @param Request  $request
  * @param Template $template
  * @param object   $controller
  * @param string   $action
  *
  * @return array
  */
 private function resolveDefaultParameters(Request $request, Template $template, $controller, $action)
 {
     $parameters = array();
     $arguments = $template->getVars();
     if (0 === count($arguments)) {
         $r = new \ReflectionObject($controller);
         $arguments = array();
         foreach ($r->getMethod($action)->getParameters() as $param) {
             $arguments[] = $param->getName();
         }
     }
     // fetch the arguments of @Template.vars or everything if desired
     // and assign them to the designated template
     foreach ($arguments as $argument) {
         $parameters[$argument] = $request->attributes->get($argument);
     }
     return $parameters;
 }
コード例 #2
0
 private function resolveDefaultParameters(Request $request, Template $template, $controller, $action)
 {
     $parameters = array();
     $arguments = $template->getVars();
     if (0 === count($arguments)) {
         $r = new \ReflectionObject($controller);
         $arguments = array();
         foreach ($r->getMethod($action)->getParameters() as $param) {
             $arguments[] = $param->getName();
         }
     }
     foreach ($arguments as $argument) {
         $parameters[$argument] = $request->attributes->get($argument);
     }
     return $parameters;
 }