concrete5 5.7: Add-On Development. "An unexpected error occurred."

Permalink 1 user found helpful
I am trying to learn Add-On development.

I have followed this tutorial:
concrete5 5.7: Add-On Development, Part 1
http://www.concrete5.org/documentation/how-tos/developers/concrete5...

I edited the code following the tutorial, and it matches the code found in "Part 2" at the following link...
http://andrewembler.com/application/files/8914/3578/2310/email_list...

After adding the Email List Signup addon, when I click on "Join our mailing list...Enter your email address" and enter a valid email address, after clicking the "Sign up" button I receive the following error:

An unexpected error occurred.
Class 'Concrete\Package\EmailListSignup\Models\EmailListSignup' not found

I also downloaded the code referenced here:
http://andrewembler.com/application/files/8914/3578/2310/email_list...
After installing the add-on again, I continue to receive the same error message:

An unexpected error occurred.
Class 'Concrete\Package\EmailListSignup\Models\EmailListSignup' not found

I cannot figure out what is causing this error.

In addition, I am having no success searching for other Add-On tutorials for 5.7. I can't seem to find any relevant information in the Docs.

Any suggestions on why I get the error listed above, or where I can find more Add-On tutorials? Thanks!

Here is my Environment Information:
# concrete5 Version
Core Version - 5.7.5.6
Version Installed - 5.7.5.6
Database Version - 20151221000000

# concrete5 Packages
Customize Editing Interface (0.9.1), Email List Signup (1.5.5), Login/Logout Link (1.0).
...

SnowyMountainWeb
 
mesuva replied on at Permalink Best Answer Reply
mesuva
I think that tutorial is just a little out of date. When 5.7 first came out classes in a package could be put into a models directory and those would be auto-loaded, but that has been replaced by the use of a src directory. That would explain your error message.

I think the rest of the tutorial should be fine, it's just a case of moving your models into the right directory and adjusting the namespaces.

I did a video a while back to try and explain namespacing (and to help me understand it myself). See this point of the video where I cover the src directory:
https://youtu.be/FjJJUrggPM0?t=700...
SnowyMountainWeb replied on at Permalink Reply
SnowyMountainWeb
That answered my question and solved my problem.

Thanks!
jsmrajni replied on at Permalink Reply
can you Please tell me what you done with files ..
fatcatsanonymous replied on at Permalink Reply
Hi Mesuva,
I watched you video which was a great help in understanding the concrete5 namespacing and file structure, Thanks very much for that.

I'm still getting an Class 'Concrete\Package\EmailListSignup\Src\EmailListSignup' not found error though, and have checked each reference over and over.
My email-list.signup php file is in an src folder and the document head is as follows:
namespace Concrete\Package\EmailListSignup\Src;
use Concrete\Core\Legacy\Model;
use Loader;

class EmailListSignup extends Model {

I'd really appreciate a hint,
Thanks,
Una
mesuva replied on at Permalink Reply
mesuva
From what you have written it looks like the filename of your class isn't correct.

In your package, the src folder should be lowercase, but then the classes inside should be CamelCase.

So src/EmailListSignup.php
fatcatsanonymous replied on at Permalink Reply
Thanks a lot, that has helped me on to the next level!