milesj / uploader

[Deprecated] A CakePHP plugin for file uploading and validating.
MIT License
193 stars 73 forks source link

Fatal error: Class 'AttachmentBehavior' not found #110

Closed louim closed 11 years ago

louim commented 11 years ago

Hello!

I have tried to install the uploader plugin, but I always get the following error:

Fatal error: Class 'AttachmentBehavior' not found in /Users/lmcouture/Projets/mrc-bellechasse/admin/code/lib/Cake/Utility/ClassRegistry.php on line 156

I have followed installation as specified on you website, Installing composer, adding the composer.json file, and getting composer to install the project and its dependencies.

I also added the

require_once dirname( __DIR__ ) . '/Vendor/autoload.php';

to the Config/core.php file as specified in the installation instructions. I still get the same error.

milesj commented 11 years ago

You have to import the AttachmentBehavior if you are referencing constants. CakePHP doesn't have an autoloader.

App::uses('AttachmentBehavior', 'Uploader.Model/Behavior');

Or use strings instead of constants.

louim commented 11 years ago

I thought Composer autoloader was to be used for that? Because loading the behavior manually as you said makes it trip on the next class not loaded. I now get

Fatal error: Class 'Aws\Common\Enum\Region' not found

Trying to save to AWS?

milesj commented 11 years ago

Composer autoloading only applies to packages installed with Composer, not Cake itself.

What is present in the /Vendor/composer/autoload_namespaces.php file? I would debug the ClassLoader as this seems like a Composer/environment problem.

hardiksondagar commented 9 years ago

I'm facing the same problem, can you share your composer.json file