Return sfView::NONE in Symfony2

Posted February 20th, 2011 in Razno by Metod

In Symfony 1.x if you wanted to output some text or json or something else and not use a template for that action you would just do the following:

However, in Symfony2 that isn’t working anymore. Every action must return a response, so you can do the following:

Access component variables in it’s controller in symfony 1.0

Posted December 16th, 2010 in Snippets by Metod

Today I was wondering how to access variables in a symfony component controller that were passed there through third parameter in a include_component() call. So I found a solution and am posting this as a reminder to me or anyone else who is stuck with symfony 1.0 and is wondering the same thing. You can call this method inside your class someComponents extends sfComponents.

  1. $vars = $this->getVarHolder()->getAll();

Returns an associative array of variables.

Doctrine connection error – symfony 1.4 – php 5.3

Posted November 20th, 2010 in Tehnikalije by Metod

I just got in the sandbox with symfony 1.4 & php 5.3.3. In the beginning everything went well, untill I tried to pull some data from a database. I got this error:

  1. PDO Connection Error: SQLSTATE[HY000] [2002] No such file or directory

Error log said:

  1. PHP Warning:  PDO::__construct() [<a href=‘pdo.–construct’>pdo.–construct</a>]: [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock)

It made it clear that mysql.sock was missing or I had some configuration problems. Turns out my php.ini file had to be changed a bit.

  1. pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock

Solution?
Find out where mysqld.sock or mysql.sock is residing and change the default value in your php.ini. That should solve the problem.