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:

http://.../input?year=2009&month=9

 Answers

3

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
 
5

Take a look at

vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php

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',
        self::HEADER_CLIENT_HOST  => 'X_FORWARDED_HOST',
        self::HEADER_CLIENT_PROTO => 'HTTP_X_FORWARDED_PROTO',
        self::HEADER_CLIENT_PORT  => 'HTTP_X_FORWARDED_PORT',
    );

Reference - http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#x-forwarded-for

Monday, September 12, 2022
 
3

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 ...
</Location>

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

Tuesday, September 13, 2022
1

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):

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

// Doctrine
$items = Doctrine_Query::create()
       ->from('Example e')
       ->leftJoin('e.Foobar')
       ->where('e.id = ?', 20)
       ->execute();
?>

(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: http://www.doctrine-project.org/documentation/manual/1_2/en/introduction:doctrine-explained

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
3

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

firewalls:
    secured_area:
        form_login:
            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
 
lenkite
 
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