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

[generate:entity:content] in drupal 9 does not create entity table #4286

Open
stef-van-looveren opened this issue Nov 17, 2020 · 5 comments
Open

Comments

@stef-van-looveren
Copy link
Contributor

Problem/Motivation

Generating a content entity does not create entity table.

How to reproduce

  • Drupal 9.0.7
  • Drupal console version 1.9.5
bash-5.0$ drupal generate:entity:content

 // Welcome to the Drupal Content Entity generator
 Enter the module name [admin_toolbar]:
 > bid_offer

 Enter the class of your new content entity [DefaultEntity]:
 > Offer

 Enter the machine name of your new content entity [offer]:
 >

 Enter the label of your new content entity [Offer]:
 >

 Enter the base-path for the content entity routes [/admin/structure]:
 >

 Do you want this (content) entity to have bundles? (yes/no) [no]:
 >

 Is your entity translatable? (yes/no) [yes]:
 > no

 Is your entity revisionable? (yes/no) [yes]:
 >

 Do you want this (content) entity to have forms? (yes/no) [yes]:
 >

 Do you want this (content) entity to have an owner? (yes/no) [yes]:
 >

Generated or updated files
 Generation path: /var/www/html/web
 1 - modules/custom/bid_offer/bid_offer.permissions.yml
 2 - modules/custom/bid_offer/src/OfferAccessControlHandler.php
 3 - modules/custom/bid_offer/src/Entity/OfferInterface.php
 4 - modules/custom/bid_offer/src/Entity/Offer.php
 5 - modules/custom/bid_offer/src/Entity/OfferViewsData.php
 6 - modules/custom/bid_offer/src/OfferListBuilder.php
 7 - modules/custom/bid_offer/src/OfferHtmlRouteProvider.php
 8 - modules/custom/bid_offer/bid_offer.links.menu.yml
 9 - modules/custom/bid_offer/bid_offer.links.task.yml
 10 - modules/custom/bid_offer/bid_offer.links.action.yml
 11 - modules/custom/bid_offer/src/Form/OfferSettingsForm.php
 12 - modules/custom/bid_offer/src/Form/OfferForm.php
 13 - modules/custom/bid_offer/src/Form/OfferDeleteForm.php
 14 - modules/custom/bid_offer/templates/offer.html.twig
 15 - modules/custom/bid_offer/offer.page.inc
 16 - modules/custom/bid_offer/src/Form/OfferRevisionDeleteForm.php
 17 - modules/custom/bid_offer/src/Form/OfferRevisionRevertForm.php
 18 - modules/custom/bid_offer/src/Controller/OfferController.php
 19 - modules/custom/bid_offer/src/OfferStorage.php
 20 - modules/custom/bid_offer/src/OfferStorageInterface.php


 Generated lines: 1434

The error

When i proceed to /admin/structure/offer:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'x__x.offer' doesn't exist: SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM {offer} "base_table") "subquery"; Array ( ) in Drupal\Core\Entity\EntityListBuilder->getEntityIds() (line 104 of core/lib/Drupal/Core/Entity/EntityListBuilder.php).

@lkc-nvl-stf
Copy link

If any one is struggling with this issue, it is because the module was enabled before the creation of the entity, resulting in the skipping of any table creation.

Solution:
Use this module: https://www.drupal.org/project/devel_entity_updates

and run "drush entup"

@aqala
Copy link

aqala commented Jun 11, 2023

Thanks, works for me

@UttamKarmakar007
Copy link

Thanks works for me too

@nmeegama
Copy link

Thanks a lot
a head scratcher really

@capysara
Copy link

capysara commented Jan 3, 2024

I had the same problem, and the comments in this issue helped me get to the root of it. In my case, I answered "No" (which is the default provided response) to "The entity type has bundle?" It didn't create the schema.info.yml file, which means it didn't create the entity.
When I answered "Yes", I had no issues.

Thanks!

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

No branches or pull requests

6 participants