0
votes

I'm developing an October CMS plugin, say author.pluginname, on a windows platform.

The file storage/framework/classes.php is meant to be auto-generated with the links of my classes, correct?

I'm not sure if that is always the case and I don't know if I need to or how to force it happen. The two cases were : 1) I just created a new class, 2) I rsynced my plugin to another test (linux server).

For example, I just copied my plugin to a new October CMS installation but and after installing the plugin with plugin:refresh, it doesn't appear in the classes.php file.

I visit a page where a component is being used and I get a class not found error:

"Class 'author\plugin\Models\modelx' not found" on line 653 of /pathtowww/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php

when I grep my author, it finds some classes but not all: grep -i author storage/framework/classes.php

I had to add it manually to make it work but I assume this is not what we should be doing. So is there something I ought to be writing in the Class file or 'registering' in the Plugin.php folder?

Note this plugin is not in the Marketplace (obviously as it's not developed).

Also, when I create a new class with the Builder plugin, it does appear in the classes.php. When I create it with my text editor, it often does not. Apologies if that is obvious but I'm quite confused....!

1
p.s. I should say that I have already added my registerComponents in my Plugin.php but nothing about any models. My register() is empty... ``` public function registerComponents() { return [ 'author\plugin\Components\SoftwareUser' => 'software_user', ]; } ``` - Alexie
I discovered the solution for problem case 2 (deploying my software to Linux): Windows is case insensitive so I typo I did wasn't found until I deployed on Linux. Still not sure how to regenerate class.php though (or if I need to) when creating a new class (in my case a Job for the queue)... - Alexie
storage/framework/classes.php you do not need to generate it, its automatically generated by CMS itself. if its not generating may be its permission issue for storage folder give it proper write permission and it will automatically generated. - Hardik Satasiya
Thanks @HardikSatasiya. Permissions were correct. - Alexie

1 Answers

0
votes

I have found the issues' solution(s), in case anyone runs into these problems.

1) If using Windows + another operating system, make sure the folder/file names are in the correct case. Windows is case insensitive so a typo will not result in an error until you migrate to Linux / OSX

2) Classes.php is generated automatically ONLY if the namespace matches the directory structure of your file. So if you move the file (or have the wrong namespace), classes.php will not be generated and you will get a class not found.