Symfony\Component\HttpFoundation\Request::setFactory PHP 메소드

setFactory() 공개 정적인 메소드

This is mainly useful when you need to override the Request class to keep BC with an existing system. It should not be used for any other purpose.
public static setFactory ( callable | null $callable )
$callable callable | null A PHP callable
    public static function setFactory($callable)
    {
        self::$requestFactory = $callable;
    }

Usage Example

예제 #1
0
 /**
  * @param string $type
  */
 private static function configureFactory($type)
 {
     if (version_compare(Kernel::VERSION, '2.5', '<')) {
         // nothing to configure as Request::setFactory require SF > 2.5
         return;
     }
     if (!in_array($type, array('host_with_path', 'host_with_path_by_locale'))) {
         return;
     }
     Request::setFactory(function (array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) {
         return new SiteRequest($query, $request, $attributes, $cookies, $files, $server, $content);
     });
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Request::setFactory