0

I was following this tutorial to create an most simple custom module.

I have created files inside /modules/elevator_search:

enter image description here

And in the /src/Controller I've placed: enter image description here

The /modules/elevator_search/evelator_search.info.yml:

name: Elevator Search
description: Moduł wyszukiwarki wind
package: Custom
type: module
version: 1.0
core: 8.x

The /modules/elevator_search/evelator_search.module is empty.

The /modules/elevator_search/evelator_search.routing.yml:

elevator_search.content:
  path: '/elevator_search'
  defaults:
    _controller: 'Drupal\elevator_search\Controller\EvelatorController::content'
    _title: 'Hello world'
  requirements:
    _permission: 'access content'

The /modules/elevator_search/src/Controller/ElevatorController.php:

<?php
/**
@file
Contains \Drupal\elevator_search\Controller\ElevatorController.
 */

namespace Drupal\elevator_search\Controller;

use Drupal\Core\Controller\ControllerBase;

class EvelatorController extends ControllerBase {
  public function content() {
      return array(
          //'#type' => 'markup',
          '#markup' => t('Hello world'),
        );
  }
};

It did show up under /admin/modules: enter image description here

But when I try to install it I get an error:

ReflectionException: Class Drupal\elevator_search\Controller\EvelatorController does not exist in ReflectionMethod->__construct() (line 123 of core/lib/Drupal/Core/Entity/EntityResolverManager.php).

closed as off-topic by kiamlaluno Jul 13 '16 at 6:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced, was solved by a cache clear, or was a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers." – kiamlaluno
If this question can be reworded to fit the rules in the help center, please edit the question.

3

Your class' name is "EvelatorController", the name of the php file of the class is "ElevatorController.php" - it is just a spelling problem

Not the answer you're looking for? Browse other questions tagged or ask your own question.