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

Skip abstract entity type classes from being exposed with their short… #5856

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

ceesgeene
Copy link
Contributor

It is possible the entity type class is abstract. For example the quiz module uses this for its QuizResultAnswer and QuizQuestion.

When executing drush php on a site with the quiz module enabled the following exception is triggered:

Fatal error: Class QuizResultAnswer contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\quiz\QuizAnswerInterface::score, Drupal\quiz\QuizAnswerInterface::getResponse) in {...}/vendor/drush/drush/src/Commands/core/CliCommands.php(319) : eval()'d code on line 1

@weitzman
Copy link
Member

weitzman commented Feb 4, 2024

@chx any thoughts?

@chx
Copy link
Contributor

chx commented Feb 4, 2024

knee jerk reaction:

Untitled

I will try to think on something. Reflection probably.

@weitzman weitzman merged commit 13a65b6 into drush-ops:12.x Feb 23, 2024
2 checks passed
@chx
Copy link
Contributor

chx commented Feb 23, 2024

Ah sorry for not getting back to you, I was thinking this over just today on the plane: I would argue the opening statement is not correct.

It is possible the entity type class is abstract.

Possible? In the sense that core doesn't throw an error at you for doing it, sure it is possible but there can be any number of calls which will die. If you have an abstract base class for your entities do not mark it with @ContentEntityType. This is pure nonsense. Such an entity can not be ::create() 'd loaded or anything. It's not an entity. And our annotations do not inherit so you do not even save work by doing this.

@weitzman
Copy link
Member

That makes sense. Quiiz is misbehaving here. Anyway, this PR is already merged and it added just a small condition so lets keep it. Thanks everyone.

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

Successfully merging this pull request may close these issues.

None yet

3 participants