Tracking down problem areas in your code can be tricky and time consuming. You may already be aware that in your development environment, Symfony very helpfully reports problems to you by way of a Stack Trace:
But did you know you can improve on this output by turning the lines of code into clickable links that will load up your IDE of choice?
All we need to do is add in an
ide entry under the
framework configuration inside our
config.yml file and the very next time you see an error message like the above, you will have the ability to click on the file and be not only taken to that file, but your cursor will be placed on the very line of problematic code.
# app/config/config.yml framework: ide: 'phpstorm://open?file=%%f&line=%%l'
By the way, this isn't just a PHPStorm thing - you can use this for Sublime, or any other editor that allows files to be opened with a special file link format.
Now, depending on how you work this may or may not be useful to you.
Personally, I like to work using Virtual Machines - having my laptop (for example) running PHPStorm, a terminal session to the VM, and a MySQL client open as needed.
When I save a file it would be automatically uploaded to the virtual machine, where I have used Ansible to build the system to the exact same spec as what the real / production server(s) would be using. I do this because it removes many problems ("it works on my machine!"), and simplifies my life.
Unfortunately, doing this will cause an issue with the links that are generated. PHPStorm will try and open the absolute path of the file that lives on your server / Virtual Machine, rather than the local copy of the file. Which is... unfortunate.
I dug through the code that generates these links and couldn't find a solution to this problem.
However, this may be useful to you, so I wanted to share it anyway.
If you have found this video helpful, please consider sharing. I really appreciate it.
|3||Block Select Text||00:27|
|4||Ctrl / Cmd Return||00:37|
|5||Ctrl / Cmd Click||01:03|
|10||Pubf, Prif, Prof... Say what?||01:10|
|11||Quick Text Selection||01:25|
|12||PHPStorm Symfony 2 Plugins||03:41|
|13||How to Quickly Open Files||01:47|
|14||Customising Getter / Setter Templates||02:32|
|15||Changing our PHP Version in PHPStorm||01:43|
|16||PHPStorm Live Templates Are Epic||07:24|
|17||Quickly Re-Open Recently Used Files||01:22|
|19||Better Find and Replace with Regular Expressions||07:18|
|20||Recover Delete Files / Folders With PHPStorm||03:02|
|21||Become a Better Developer with PHP Inspections (EA Extended)||03:50|