Symfony – Custom (Private) Plugins – Naming Convention
If you ever tried to create your own plugin and got an error message similar to the following; “Uncaught exception ‘InvalidArgumentException’ with message ‘The plugin “myPlugin” does not exist.’ it’s because you didn’t name your plugin folder correctly.
Consider the following:
#bad /plugins/myCustom #good /plugins/myCustomPlugin
When I was googling for the cause of the above exception there were no readily available answers, even via Symfony’s docs for plug-ins. All I could find via Symfony’s site about the plug-ins was a blurb about the difference between Private and Public plug-ins, but now how to manage private plug-ins.
So, not being able to find the issue via google, I checked the source code and found that in line #482 of /lib/config/sfProjectConfiguration.class.php there is the following code:
$finder = sfFinder::type('dir')->maxdepth(0)->ignore_version_control(false)->follow_link()->name('*Plugin');
This line is forcing you, when you create a private plug-in, to append the word Plugin to your actual plugin name (directory) as mentioned above in the “good” example. I am not sure why the Symfony devs are forcing us to append Plugin when the directory is clearly namespacing plugins for us.
Hopefully this helps anyone else who had to jump down this rabbit hole.
- Symfony – Share Template Across Multiple Apps
- PHP – Symfony – Speed up CLI Commands – Do Not Load Web Plugins
- PHP – Symfony – Build Model – No yml schema found
- Symfony – Propel – Determine Propel Version
- Symfony – Doctrine – Call to a member function evictAll on a non-object
- Symfony – Standard API for Logging Using __callStatic
- Symfony – Symfony 2 Security Audit Results
- Symfony – Serve External Apis from External Hosts – jQuery – Yui
- Symfony – sfGuardPlugin – Use Email Instead of Username
- Symfony – PHP – Possibly Forking 1.x so Invested Companies don’t Lose Millions