Archive for the ‘Symfony’ category

Helpful debug function in Symfony

September 29th, 2010

When I debug my code I often use echo-like function together with  <pre></pre> to include white spaces in output. Hence, I create d function:

function d($var = 'test') {

    echo '<pre>';
    var_dump($var);
    echo '</pre>'
}

and  place it in the beggining  of ProjectConfiguration.php file. Then I can use it in any place of project – in command line tasks as well. [Earlier I placed it in frontend_dev.php file, but then I could not use it in tasks.]

Overriding setter/getter in Symfony

July 2nd, 2010

Overriding methods should not be a problem, but it can make you confused if you don’t know how magic functions are used in Symfony 1.4 models.

In this short article I will explain why usual overriding does not work in Symfony models and how to override methods handled by magic functions.

» Read more: Overriding setter/getter in Symfony

Flexmaniaks on Facebook