Where do I place base action class in Symfony plugin?

548 Views Asked by At

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?

2

There are 2 best solutions below

1
On BEST ANSWER

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.

0
On

you can place it in the lib directory of your plugin. This is what the generate:plugin-module task of the sfTaskExtraPlugin does.