Question

What is the best way to autoload abstract classes

I have a class Formprocessor_Userregistrate extends Formprocessor Both files are in the same directory, but it cannot find Formprocessor

I already used $autoloader->registerNamespace('Formprocessor_');

When I change the name of Formprocessor into Formprocessor_Formprocessor; I get an "invalid controller" exception

What is the best technique to load those abstract classes?

thanks, Richard

Was it helpful?

Solution

ZF convention specifies that you should keep your abstract at the same directory level as the concrete implementations. So, you probably want this:

Formprocessor/Userregistrate.php

Which would contain:

class Formprocessor_Userregistrate extends Formprocessor_Abstract

And this:

Formprocessor/Abstract.php

Which would contain

abstract class Formprocessor_Abstract
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top