Saturday, 30 April 2011

How to setup symfony project?

Hey Fox,

Download symfony project.
create folder let suppose symfony_test i.e, mkdir symfony_test
Go into symfony_test and create lib folder i.e, c:\>symfony_test> mkdir lib
Go into lib folder and create vendor folder ie., c:\>symfony_test\lib\> mkdir vendor


extract symfony project into vendor folder.

Further, open command prompt and type the following
c:\> cd wamp\www\symfony_test
c:\wamp\www\symfony_test> php lib\vendor\symfony\data\bin\symfony generate:project jobeet
c:\wamp\www\symfony_test> php symfony configure:database "mysql:host=localhost;dbname=jobeet" root root
c:\wamp\www\symfony_test> symfony generate:app --escaping-strategy=on --csrf-secret=UniqueSecret frontend


Now, create the frontend application by running the generate:app task:
$ php symfony generate:app frontend

create model, form and filter on the basis of schema.yml and then

I am going to create a module "job" on the basis of model "JobeetJob"

c:\wamp\www\symfony_test> php symfony doctrine:generate-module --with-show --non-verbose-templates frontend job JobeetJob


How to run symfony on dos prompt?


To run symfony in windows machine, you just set the Environment Vairables if not set for php.

Following are the steps to set Environment Variables on window machine:

Right click on MY Computer
Go to properties
Choose the Advanced tab
Click Environment Variables
Now you can edit the environment variables of the system.
In this window, you will see User Variables and System Variables.
If you change in User Varibale then changes will be applicable for your login only.
If you change in System Variable then changes will be applicable for all users.
find "PATH" variable in the list of system variables.
Select it and press edit button given below.

Let Suppose, this example using wamp and wamp installed in D: drive.


append the following line in variable value fields:

this folder conatains php.exe file.

now press OK and save the configuration.

Futher, the most important point. Restart your machine.

Note the ; character. It is used to separate directories in the variables, so be sure it is present.

Again, D:\path\to\php is where your php.exe is located.


Wednesday, 27 April 2011

How to read last 10 line in a file using linux command?

tail -10 filename


tail -f filename


How to go start and end of the file open fron VI?

For Beginning press esc then :0
For Ending press esc :$ OR shift+g


Tuesday, 26 April 2011

How to put error message below the field in symfony form?


Got to /lib/form/doctrine/BaseFormDoctrine.class.php
adn put following line in public function setup().
$row_format   = "<tr>\n<th>%label%</th>\n<td>%help%%field%%error%%hidden_fields%</td>\n</tr>\n";

see example below:

## /lib/form/doctrine/BaseFormDoctrine.class.php

 * Project form base class.
 * @package    passportServices
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormBaseTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
abstract class BaseFormDoctrine extends sfFormDoctrine
  public function setup()
    $row_format   = "<tr>\n<th>%label%</th>\n<td>%help%%field%%error%%hidden_fields%</td>\n</tr>\n";


How to remove .svn folder using linux command?

Go to that folder and run the following command:

find ./ -name ".svn" | xargs rm -Rf