Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception 'ReflectionException' with message 'Class \Drupal\testmodule\Controller\TestModuleEntityController does not exist' with generate:entity:content and revisions enabled #2881

Closed
showards opened this issue Nov 4, 2016 · 4 comments
Labels

Comments

@showards
Copy link

showards commented Nov 4, 2016

It looks like when revision capabilities are utilized in generate:entity:content an exception is thrown. I don't know enough to help with it, but the generation code lives in templates/module/src/entity-content-route-provider.php.twig and was introduced in 0dc8f71. The offending Class code is not generated when revisions are disabled. I've attached a rundown of the setup including the exact steps used to generate the error. The error appears at the bottom of the document.

I'm not sure if it's something I'm doing or if it's missing code in the generate:entity:content portion of Drupal Console. :(

Drupal Console - New Module Revisions.txt

EDIT: Note, there are errors in the above text when using drupal console; "commands.yaml.unset.key.yml Unable to parse at line 2 (near " arguments:")." I am pretty sure those will be fixed in 2878, though the version of console used is 1.0.0-rc7

@gone3uo6
Copy link
Contributor

Controller is not generated using generate:entity:content

@plopesc
Copy link
Contributor

plopesc commented Nov 10, 2016

I'm having the same issue with Console 1.0.0-rc8 & Drupal 8.2.2

Thanks

@gone3uo6
Copy link
Contributor

gone3uo6 commented Nov 10, 2016

I think "getControllerPath()" in line 208 in EntityContentGenerator.php...
$this->extensionManager->getModule($module)->getControllerPath() .'/'.$entity_class.'Controller.php',
should be "getControllerDirectory()"
which is what is used in ControllerGenerator.php

EDIT: I tested this and the controller now generates but the path needs to be modified in Extensions.php.
Extensions.php...
public function getControllerDirectory($fullPath = false) { return $this->getSourcePath($fullPath) . '/Controller/'; }

'/Controller/' should be '/Controller'

but this will probably break ControllerGenerator.php

so maybe a new function should be added and named getEntityControllerPath()

@gone3uo6
Copy link
Contributor

I modded getControllerDirectory() and renamed it to getControllerPath(). Also modded ControllerGenerator.php to use the renamed function. I'll push the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants