You will have to add a require_once() statement in your action class.
That's how it's done in several plugins.
Fabien
Tamcy wrote:
> I am not asking for extending autoloading (This should be a user list
> question).
> I want to point out that when autoload is invoked by sfController
> the module name ("sfContext::getInstance()->getModuleName()") is not
> yet
> available and prevents me from going for a better separation by
> writing a base action class for a particular module (here I mean
> symfony module)
> and putting it in that module's lib directory. And I doubt if this can
> be solved by extending
> autoloading - again, module name is not yet available.
>
> On Aug 21, 7:21 pm, Kiril Angov <[EMAIL PROTECTED]> wrote:
>> Yes, you can extend the autoloading. The information that wil help you
>> comes from the way sfZendFrameworkBridge
>> works.http://www.symfony-project.com/book/trunk/17-Extending-Symfony
>> and the section is: Bridges to Other Framework's Components
>>
>> The important part is (this is to be done in the application settings.yml):
>>
>> [snip]
>> Then, extend the autoload routine by specifying which library to
>> consider when the autoloading fails with symfony:
>>
>> .settings:
>> autoloading_functions:
>> - [sfZendFrameworkBridge, autoload]
>> - [sfEzComponentsBridge, autoload]
>> - [myAutoload, autoload]
>>
>> [snip]
>>
>> and then the class itself:
>>
>> <?php
>>
>> class myAutoload
>> {
>> static public function autoload($class)
>> {
>> // put your logic to load that problematic class and more if needed
>>
>> return false;
>> }
>>
>> }
>>
>> ?>
>>
>> -- Kupo
>>
>> Tamcy wrote:
>>> Hi,
>>> We know that symfony's autoload mechanism separates classes into two
>>> levels or scopes, global and module. Module classes lie under apps/
>>> [appname]/modules/[module_name]/lib, and access is limited to the same
>>> module scope.
>>> Consider this situation: I want to write a class which is
>>> "sfBaseUserAction extends sfAction". It provides additional methods
>>> for the user module. As it is solely used by the user module it should
>>> be placed under "modules/user/lib/sfBaseUserAction.class.php", and
>>> user module actions should extend from it. Sounds good, but since
>>> module name is not set when the module action is being loaded, symfony
>>> fails detecting the existence of "user/sfBaseUserAction" and
>>> autoloading fails.
>>> Moving it to application lib/ directory is ok, but as it is somewhat
>>> dedicated I prefer not to mess with app or porject lib.
>>> Is it possible to add one more fallback in autoloading for this case?
>>> Tamcy
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---