learning-drupal-as-a-framework icon indicating copy to clipboard operation
learning-drupal-as-a-framework copied to clipboard

Drush Command Issue

Open rhache opened this issue 1 year ago • 3 comments

When I run the the drush offer-create-seeds command, I get the following error in the terminal:

  Command "offer-create-seeds" is not defined.  

However if I move the following code from the offer.services.yml into a drush.services.yml in the offer module folder it works:

services:
  offer.commands:
    class: \Drupal\offer\Commands\SeedGeneratorCommand
    tags:
      - { name: drush.command }

The only issue, and I'm not sure if it matters at this point, is you get the following error after running the drush command:

In Query.php line 141:
                                                                                  
  Entity queries must explicitly set whether the query should be access checked   
  or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck().  

rhache avatar Dec 31 '23 15:12 rhache

I see, you are probably on Drupal 10. I'll fix this quickly and let you know in here!

More here: https://stefvanlooveren.me/blog/entityquery-access-check-will-be-enforced-drupal-10

stef-van-looveren avatar Jan 03 '24 08:01 stef-van-looveren

Can you check out https://github.com/stef-van-looveren/learning-drupal-as-a-framework/commit/618472fc7eae3d07cc350c8a4378af491f1aa95a

This fixes it. I do not know yet why it is not working in Drush 12. Drush.services.yml will be deprecated in the future so I would not recommend. Thank you for logging this, btw!

stef-van-looveren avatar Jan 03 '24 16:01 stef-van-looveren

@stef-van-looveren maybe you can check this issue discussion https://github.com/drush-ops/drush/issues/5600

sarath49 avatar May 07 '24 07:05 sarath49