Asked  7 Months ago    Answers:  5   Viewed   33 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)));
Wednesday, March 31, 2021
answered 7 Months ago

Add the following rule as the first rule:

RewriteCond %{HTTP_HOST} !^(www).
RewriteRule ^(.*?)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Wednesday, March 31, 2021
answered 7 Months ago

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.

Saturday, May 29, 2021
answered 5 Months ago

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.

Sunday, June 27, 2021
answered 4 Months ago

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

Saturday, September 11, 2021
answered 1 Month ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :