I'm having trouble getting Drupal 8 to load my custom module's classes from the same namespace. Here's what I've got:
<?php
namespace Drupal\sign_up\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
// ... snip ...
class StandardForm extends CLESignUpForm
{
Which all works perfectly well on my local environment. When deployed the server says: PHP Fatal error: Class 'Drupal\sign_up\Form\CLESignUpForm' not found in /path/to/drupal/modules/sign_up/src/Form/StandardForm.php on line 21
If I add the line:
include 'CLESignupForm.php';
It works just fine. But that defeats the purpose of auto-loading classes, doesn't it? get_declared_classes() does not show my base class .. or even the currently loaded class for that matter.
Any thoughts on how to make this particular environment comply? I've already loaded the db and config directly from my local setup where it's working. Could it be a php / apache setting somehow?
use Drupal\sign_up\Form\CLESignUpForm;? - Stanislav AgapovCLESignupFormclass without help from you. So you must either use directincludestatement or rely on Drupal's autoloading feature usingusestatement (preferred). - Stanislav Agapov