Streams with multiple words in name throw errors.
Created 6 years ago by gonziis

Hey, I have a problem with my addon. I have multiple streams in my addon some have multiple words like DecisionTypeCategories etc. It installed without any errors, but when I go in CMS and try to access any links containg the name it throws Class 'Anomaly\Streams\Platform\Model\Lemumi\LemumiDecisionTypeCategoriesEntryModel' not found

Other streams that have only one name work. What am I missing here?

EDIT: Also when I try to /create the base stream which has a relationship with one of those with multiple words, it throws Class CaseClassificationModel does not exist. Like there isn't even a model created for those streams with multiple words.

frednwt  —  6 years ago Best Answer

I had this problem once, when you are created your stream you probably used camelCase or StudlyCase? But you need to use snake_case.

ryanthompson  —  6 years ago

Go through and check your bindings and model extends parts of the class in your addon. Looks like either it's not autoloading correctly OR the names were wrong / changed and aren't matching up any more. If you have an IDE it should hint and tell you "Yo.. these classes do not exist!" so to speak. We'll go from there.

gonziis  —  6 years ago

Yes, but why wouldn't it work automatically? I haven't changed any files other than the migration files. It seems to be specific to multiple words only. Couldn't it be a bug of some sort?

Also I use Sublime text, it has no autocomplete 🙍

gonziis  —  6 years ago

Ok, I found something. In storage/streams/default/models/ directory I found the entry model file. The error says Class 'Anomaly\Streams\Platform\Model\Lemumi\LemumiDecisionTypeCategoriesEntryModel' not found but the class and the file in storage directory is LemumiDecisiontypecategoriesEntryModel. Could there be a problem?

gonziis  —  6 years ago

Ok, this definetly seems as a bug. The addon file generated the classes extending names with capitalized first words, but the actual files in storage are lower cased. I changed the classes in addons to extend and use class with lowercase letters and it works now. Seems like it should be working automatically.

frednwt  —  6 years ago Best Answer

I had this problem once, when you are created your stream you probably used camelCase or StudlyCase? But you need to use snake_case.

gonziis  —  6 years ago

This is correct. I was suspicious about it but wasn't sure.