Asked  2 Years ago    Answers:  5   Viewed   79 times

how can i redirect to another action passing 2 or more parameters? this code:

$this->redirect('input/new?year=' . $year . '&month=' . $month);

results in URL:




Well, that's normal, "redirect" redirect to an absolute URL. You can do that:

$this->redirect($this->generateUrl('default', array('module' => 'input',
'action' => 'new', 'year' => $year, 'month' => $month)));
Monday, December 12, 2022

Take a look at


AWS ELB's use HTTP_X_FORWARDED_PROTO and HTTP_X_FORWARDED_PORT while Symfony looks the X_FORWARDED_PROTO and X_FORWARDED_PORT headers to judge the connection and its secure status.

You can try changing those keys in the trustedHeaders although I would not recommend directly changing them but finding a way to override those.

protected static $trustedHeaders = array(
        self::HEADER_CLIENT_IP    => 'X_FORWARDED_FOR',

Reference -

Monday, September 12, 2022

This is possible, depending on how you map to your front controller. If you're doing it via rewrite rules then you can use a <Location> instead of <Directory> block to specify a chunk of path you want to change the settings for. <LocationMatch> lets you use a regexp for the same thing.

If all of your external URLs really start with /index.php? then consider setting up a redirect rule especially for these requests:

RewriteEngine on
RewriteRule ^foo/$ ^/index.php [L]

<Location /foo/>
    php_value ...

If that's not the case, you'll need to tell us more about your application structure.

Tuesday, September 13, 2022

I'd go with Doctrine. It seems to me that it is a much more active project and being the default ORM for symfony it is better supported (even though officially the ORMs are considered equal).

Furthermore I better like the way you work with queries (DQL instead of Criteria):

// Propel
$c = new Criteria();
$c->add(ExamplePeer::ID, 20);
$items = ExamplePeer::doSelectJoinFoobar($c);

// Doctrine
$items = Doctrine_Query::create()
       ->from('Example e')
       ->where(' = ?', 20)

(Doctrine's implementation is much more intuitive to me).

Also, I really prefer the way you manage relations in Doctrine.

I think this page from the Doctrine documentation is worth a read:

To sum up: If I were starting a new project or had to choose between learning Doctrine and Propel I'd go for Doctrine any day.

Tuesday, September 6, 2022

Yes. You can use the target_path option. Using your example above:

            always_use_default_target_path: true
            default_target_path: /loggedinpage

With the above the user will always be redirected to /loggedinpage upon a successful login. Details of all the options for the security component are available in the Symfony docs (albeit slightly hidden away!)

Tuesday, December 27, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :

Browse Other Code Languages