Arrrgh Symfony2 and the recent Doctrine2 bundle wrapup screwed up?

After updating my Symfony2 things went horribly wrong in which case toke me 4 hours to resolve it. So here is what I got after the silly update:
> Installing/Updating DoctrineBundle
93be072b43f64f88dc946705610dc8d3b9eed833
HEAD is now at 93be072 Fix undefined variable. Fixes #18
PHP Fatal error:  Call to undefined method Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::addUserProviderFactory() in /[....]/vendor/bundles/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php on line 39
PHP Stack trace:
PHP   1. {main}() /[....]/app/console:0
PHP   2. Symfony\Component\Console\Application->run() /[....]/app/console:22
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /[....]/vendor/symfony/src/Symfony/Component/Console/Application.php:118
PHP   4. Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() /[....]/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:66
PHP   5.

Symfony2 and SQLite3 or PDO_SQLite extension error

If you are getting  

You need to enable either the SQLite3 or PDO_SQLite extension for the profiler to run properly

To resolved it install the php5-sqlite

sudo apt-get install php5-sqlite
#restart the apache
sudo /etc/init.d/apache2 restart

Installing Nodejs, NPM and Google V8 on UBUNTU

A) Install the essential compilers, packages and Google V8
sudo apt-get update
sudo apt-get install build-essential curl openssl libv8-2.0.3
B) Download and install the Nodejs from source
wget http://nodejs.org/dist/node-v0.4.11.tar.gz
gunzip node-v0.4.11.tar.gz
tar -xf node-v0.4.11.tar

cd  node-v0.4.11
./configure
make
make install
C) Installing the NPM
curl http://npmjs.org/install.sh | sh
Here is the lazy script to get things installed smoothly in your UBUNTU machine.

PHP custom debugging functions

Here is another debugging helper for Symfony, CodeIgniter, Kohana and Zend frameworks or your applications. Normally you would use var_dump() or print _r() for debugging but dumping the data without xdebug always a pain.

I use these custom functions depending on type of data whether an array or a class to debug my code which makes it more friendly and human-readable.


<?php

function my_print_r ($param, $bool = TRUE) {
    pre( print_r($param, $bool), FALSE);
}

function my_var_dump ($param) {
    pre(var_dump($param));
}

function my_debug ($param) {
    if (is_object($param)) {
        pre('Object: ['.get_class($param). '] => '
           . print_r(array_keys(get_object_vars($param)), TRUE), FALSE);
    }
}

function my_debug_in ($param) {
    if (is_object($param)) {
        pre('Object: [' .get_class($param).' ] => Array', FALSE);
        foreach (get_object_vars($param) as $key) {
            my_debug($key);
        }
    }
    if (is_array($param)) {
        my_print_r($param);
    }
}

function my_class($name = NULL) {
    $class = new ReflectionClass($name);
    my_print_r(Reflection::export($class));
   
}

function pre($param, $bool = TRUE) {
    if (!ini_get('xdebug.default_enable') || !$bool) {
        echo "<pre>".$param ."</pre>\n";
    }else {
        echo $param;
    }
}

?>

Symfony and sfDoctrineGuard missing installation point

If you are getting the 500 error (Call to undefined method myUser::isAnonymous.) after installing the sfGuardDoctrine plugin i.e

Call to undefined method myUser::isAnonymous.

Add these lines in your apps/app name/config/factories.yml to make to pluging to work.

all:
  user:
   class:  sfGuardSecurityUser