Useful shortcuts

Shift ⌘O spotlight like to get files

⌘O Find file by ClassName

⌘E Navigate to recent files

⌘L Go to specific line

⌘B Go to declaration of variable

How to auto style PHP code to follow PSR1/PSR2

1) Go to Preferences.

2) Search for Code Style

3) Choose PHP

4) Click on Set From..

5) Choose PSR1/PSR2 as show below:


Doctrine load fixtures – How to load particular fixture

Symfony has an option to load fixtures from command line:

$ php app/console doctrine:fixtures:load --help
 doctrine:fixtures:load [--fixtures[="..."]] [--append] [--em="..."] [--purge-with-truncate]

 --fixtures             The directory or file to load data fixtures from. (multiple values allowed)
 --append               Append the data fixtures instead of deleting all data from the database first.
 --em                   The entity manager to use for this command.
 --purge-with-truncate  Purge data by using a database-level TRUNCATE statement
 --help (-h)            Display this help message.
 --quiet (-q)           Do not output any message.
 --verbose (-v|vv|vvv)  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
 --version (-V)         Display this application version.
 --ansi                 Force ANSI output.
 --no-ansi              Disable ANSI output.
 --no-interaction (-n)  Do not ask any interactive question.
 --shell (-s)           Launch the shell.
 --process-isolation    Launch commands from shell as a separate process.
 --env (-e)             The Environment name. (default: "test")
 --no-debug             Switches off debug mode.

But if you assign the full path to fixture file with --fixtures option, its not going to load it and you’ll end up with error:

Could not find any fixtures to load in:
– full/path/to/file.php

The other option is to load the folder itself by typing the full path to folder where fixture file resides.

php app/console doctrine:fixtures:load --fixture=/src/BundleName/DataFixtures/ORM/