This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\commerce_product_restriction\Plugin\Commerce\ProductRestriction; | |
use Drupal\commerce_product_restriction\Plugin\ProductRestrictionPluginBase; | |
use Drupal\commerce_product_restriction\Plugin\ProductRestrictionPluginInterface; | |
use Drupal\Core\Entity\EntityInterface; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\Core\StringTranslation\TranslatableMarkup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Generic: | |
// Get all users with email containing "xyz" | |
$query = \Drupal::entityQuery('user') | |
->condition('mail', "XYZ", 'CONTAINS'); | |
$uids = $query->execute(); | |
// Load these entities ($uids) in our case using storage controller. | |
// We call loadMultiple method and give $uids array as argument. | |
$itemsToDelete = \Drupal::entityTypeManager()->getStorage('user') | |
->loadMultiple($uids); |