Now to my problem. I would like to use my Model Classes without a Prefix.
At this Time I use for example:
AR_User::find();

But I want to use it like this:
User::find();

How do I need to setup the Autoloader to meet my needs?

Autoloading does not do namespacing or aliasing, it merely attempts to find class files when they are referred to and not already declared.

If you want a "User" model, you can create a class specifically named "User" that extends your AR_User library class. After this, you can, although its not suggested, make the path to your models part of your include_path, and set the autoloader to be a fallback autoloader:

require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

Again, this is not suggested. Generally, you'd have a models folder, and have a naming for classes in there, typically Default_Model_User, or ModuleName_Model_User. This helps avoid naming collisions when you reuse your code.

More reading:
http://www.nabble.com/Zend_Loader_Autoloader-match-Zend_Loader-functionality-td23344467.html
http://www.nabble.com/Autoloading-models-td23330806.html
http://www.nabble.com/Autoload-models-with-no-namespace-td23387744.html

Hope this helps!
-ralph

Reply via email to