Search code examples
pluginssymfony1symfony-1.4symfony-plugins

Where do I place base action class in Symfony plugin?


I'm creating a plugin for my symfony project, which includes a base action class, i.e.:

<?php
// myActions.class.php
class myActions extends sfActions {
    /* ... */
}

Where in my plugin folder (e.g.: plugins/sfMyPlugin/???) should I place this file?

The goal is to have actions that are NOT a part of this plugin extend this class, hopefully having the class be autoloaded (similar to if it were placed under apps/my_app/lib). If it can't be autoloaded, how do I get symfony to include my php file?


Solution

  • You typically put it in your plugin's lib directory. The general conventions is also to to name with Base in the name so given your example that would be BasemyActions. Then you would also make an empty concrete class called myActions and you would extend that within your plugin thus allowing other user to complety replace myActions with their own implementation (so long as it extends the base class) or to simply extend myActions.