- Issue created by @tdnshah
- last update
over 1 year ago 10 pass - @tdnshah opened merge request.
- Status changed to Closed: works as designed
over 1 year ago 4:41pm 21 September 2023
After upgrading to D10, I was unable to save any nodes having voting functionality like "Like - Dislike" and was getting the below error
Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 141 of /mnt/www/html/devportalode230/docroot/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
1. Upgrade or be on D10 version.
2. Enable like and dislike module.
3. Add like dislike functionality to article content type.
4. Try to create and save a new article.
It was found that D10 onwards, while using entity query an accessCheck() needs to be explicitly checked which was missing in the below method getEntityResults() of the class `class VoteResultStorage extends SqlContentEntityStorage implements VoteResultStorageInterface` in the module.
Hence to fix we need to add accessCheck(True) to the entity query in the method getEntityResults.
Closed: works as designed
3.0
Code