getQuery example

$this->redirect($url);
    }

    /** * This Action can be called with a different domain. * So domain depending cookies can be changed. * This is needed when the users want's to perform an order on a different domain. * For example in a different Subshop */
    public function performOrderRedirectAction()
    {
        $hash = $this->Request()->getQuery('hash');

        $optinService = $this->container->get(OptinServiceInterface::class);

        $data = $optinService->get(OptinServiceInterface::TYPE_CUSTOMER_LOGIN_FROM_BACKEND, $hash);

        if (!\is_array($data)) {
            $this->redirect(['module' => 'backend', 'controller' => 'index', 'action' => 'index']);

            return;
        }

        

        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0')
        );

        $field = $context->getField();
        if (!$field instanceof SeoUrlAssociationField) {
            return $context->getAlias();
        }

        $context->getQuery()->addState(EntityDefinitionQueryHelper::HAS_TO_MANY_JOIN);

        $alias = $context->getAlias() . '.' . $field->getPropertyName();
        if ($context->getQuery()->hasState($alias)) {
            return $alias;
        }

        $context->getQuery()->addState($alias);

        $routeParamKey = 'route_' . Uuid::randomHex();
        $parameters = [
            '#source#' => EntityDefinitionQueryHelper::escape($context->getAlias()) . '.' . EntityDefinitionQueryHelper::escape($field->getLocalField()),
            

  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity_type.manager')
    );
  }

  /** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $num_entities = $this->entityTypeManager->getStorage('media')->getQuery()
      ->accessCheck(FALSE)
      ->condition('bundle', $this->entity->id())
      ->count()
      ->execute();
    if ($num_entities) {
      $form['#title'] = $this->getQuestion();
      $form['description'] = [
        '#type' => 'inline_template',
        '#template' => '<p>{{ message }}</p>',
        '#context' => [
          'message' => $this->formatPlural($num_entities,
            

  }

  /** * {@inheritdoc} */
  protected function exists($value) {
    // Plugins are cached so for every run we need a new query object.     $query = $this
      ->entityTypeManager
      ->getStorage($this->configuration['entity_type'])
      ->getQuery()
      ->accessCheck(FALSE)
      ->condition($this->configuration['field']$value);
    if (!empty($this->configuration['migrated'])) {
      // Check if each entity is in the ID map.       $idMap = $this->migration->getIdMap();
      foreach ($query->execute() as $id) {
        $dest_id_values[$this->configuration['field']] = $id;
        if ($idMap->lookupSourceId($dest_id_values)) {
          return TRUE;
        }
      }
      
$limit = (int) $this->Request()->getParam('limit', 20);
        $offset = (int) $this->Request()->getParam('start', 0);
        $id = $this->Request()->getParam('id', null);

        if ($id !== null) {
            $queryBuilder = $this->getUserRepository()->getRolesQueryBuilder();
            $query = $queryBuilder
                ->setFirstResult(0)
                ->setMaxResults(1)
                ->andWhere('roles.id = :role_id')
                ->setParameter(':role_id', (int) $id)
                ->getQuery();
            $count = 1;
        } else {
            $query = $this->getUserRepository()
                ->getRolesQuery($offset$limit);
            $count = $this->get('models')->getQueryCount($query);
        }

        $roles = $query->getArrayResult();

        // Strip roles with parent id set         foreach ($roles as &$role) {
            

        if (empty($products)) {
            return [];
        }

        $ids = [];
        foreach ($products as $product) {
            $ids[] = $product->getVariantId();
        }
        $ids = array_unique($ids);

        $data = $this->getQuery($ids$context)->execute()->fetchAll(PDO::FETCH_GROUP);

        $result = [];
        foreach ($data as $key => $groups) {
            $result[$key] = $this->configuratorHydrator->hydrateGroups($groups);
        }

        return $result;
    }

    /** * @param int[] $ids */
$qb = $this->models->createQueryBuilder()
            ->select('COUNT(preset)')
            ->from(Preset::class, 'preset')
            ->where('preset.name = :name');

        if ($preset->getId()) {
            $qb->andWhere('preset.id != :id')
                ->setParameter('id', $preset->getId());
        }

        $result = $qb->setParameter('name', $preset->getName())
            ->getQuery()
            ->getSingleScalarResult();

        if ($result > 0) {
            throw new CustomValidationException(sprintf('Preset with name %s already exists', $preset->getName()));
        }
    }

    /** * @param bool $fetchAll * * @return array[] */

  protected function getUnassociatedRevisions($entity_type_id$entity_ids = NULL) {
    $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);

    $query = \Drupal::entityTypeManager()
      ->getStorage($entity_type_id)
      ->getQuery()
      ->allRevisions()
      ->accessCheck(FALSE)
      ->notExists($entity_type->get('revision_metadata_keys')['workspace']);

    if ($entity_ids) {
      $query->condition($entity_type->getKey('id')$entity_ids, 'IN');
    }

    return $query->execute();
  }

}
return $this;
    }

    /** * Overrides the original function to add the SQL_NO_CACHE parameter * for each doctrine orm query if the global shopware debug mode is activated. */
    public function getQuery()
    {
        /** @var Query<ModelEntity> $query */
        $query = parent::getQuery();

        $em = $this->getEntityManager();

        if ($em->isDebugModeEnabled() && $this->getType() === self::SELECT) {
            $em->addCustomHints($query, null, false, true);
        }

        return $query;
    }

    public function getEntityManager(): ModelManager
    {

    $this->entities[] = $entity;
    $entity->enforceIsNew();
    $entity->save();
  }

  /** * Tests basic functionality. */
  public function testConfigEntityQuery() {
    // Run a test without any condition.     $this->queryResults = $this->entityStorage->getQuery()
      ->execute();
    $this->assertResults(['1', '2', '3', '4', '5', '6', '7']);
    // No conditions, OR.     $this->queryResults = $this->entityStorage->getQuery('OR')
      ->execute();
    $this->assertResults(['1', '2', '3', '4', '5', '6', '7']);

    // Filter by ID with equality.     $this->queryResults = $this->entityStorage->getQuery()
      ->condition('id', '3')
      ->execute();
    
$route_match->getParameter($entity_type_id)->willReturn($fieldable_entity->reveal());

    // \Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplay() is a     // static method and can not be mocked on its own. All of the expectations     // of that method are mocked in the next code block.     $entity_query = $this->prophesize(QueryInterface::class);
    $entity_query->condition(Argument::cetera())->willReturn($entity_query);
    $entity_query->execute()->willReturn([
      'a_fieldable_entity_type.the_bundle_id.full' => 'a_fieldable_entity_type.the_bundle_id.full',
    ]);
    $entity_storage = $this->prophesize(EntityStorageInterface::class);
    $entity_storage->getQuery('AND')->willReturn($entity_query->reveal());
    $entity_storage->loadMultiple(Argument::type('array'))->willReturn([
      'a_fieldable_entity_type.the_bundle_id.full' => $entity_display->reveal(),
    ]);
    $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
    $entity_type_manager->getStorage('entity_view_display')->willReturn($entity_storage->reveal());
    $module_handler = $this->prophesize(ModuleHandlerInterface::class);

    $container = new ContainerBuilder();
    $container->set('entity_type.manager', $entity_type_manager->reveal());
    $container->set('module_handler', $module_handler->reveal());
    \Drupal::setContainer($container);

    
$configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('entity_type.manager'),
    );
  }

  /** * {@inheritdoc} */
  public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor): array {
    $media_type_ids = $this->mediaTypeStorage->getQuery()->execute();

    // Making the title for editor drupal media embed translatable.     $static_plugin_config['drupalMedia']['dialogSettings']['title'] = $this->t('Add or select media');

    if ($editor->hasAssociatedFilterFormat()) {
      $media_embed_filter = $editor->getFilterFormat()->filters()->get('media_embed');
      // Optionally limit the allowed media types based on the MediaEmbed       // setting. If the setting is empty, do not limit the options.       if (!empty($media_embed_filter->settings['allowed_media_types'])) {
        $media_type_ids = array_intersect_key($media_type_ids$media_embed_filter->settings['allowed_media_types']);
      }
    }

    public function getActivePlugins()
    {
        $builder = $this->entityManager->createQueryBuilder();

        $builder->select(['plugins'])
            ->from(Plugin::class, 'plugins')
            ->where('plugins.active = true')
            ->andWhere('plugins.installed IS NOT NULL');

        return $builder->getQuery()->getResult(
            AbstractQuery::HYDRATE_OBJECT
        );
    }

    /** * Returns the theme preview thumbnail. */
    private function getThemeImage(Template $theme): ?string
    {
        $directory = $this->pathResolver->getDirectory($theme);

        


  /** * Tests that Content Moderation works with entities being resaved. */
  public function testContentModerationResave() {
    $entity = $this->entityStorage->create();
    $this->assertSame('draft', $entity->get('moderation_state')->value);
    $this->assertNull(\Drupal::state()->get('content_moderation_test_resave'));
    $this->assertNull(ContentModerationState::loadFromModeratedEntity($entity));
    $content_moderation_state_query = $this->contentModerationStateStorage
      ->getQuery()
      ->accessCheck(FALSE)
      ->count();
    $this->assertSame(0, (int) $content_moderation_state_query->execute());
    $content_moderation_state_revision_query = $this->contentModerationStateStorage
      ->getQuery()
      ->accessCheck(FALSE)
      ->allRevisions()
      ->count();
    $this->assertSame(0, (int) $content_moderation_state_revision_query->execute());

    // The test module will re-save the entity in its hook_insert()
return ($pathElems[2] ?? '') === 'registration';
    }

    private function isRegistrationConfirmation(RequestInterface $request): bool
    {
        return ((string) $request->getUri()) === self::CONFIRMATION_URL;
    }

    private function getQueryParameter(RequestInterface $request, string $param): string
    {
        $query = [];
        \parse_str($request->getUri()->getQuery()$query);

        TestCase::assertIsString($query[$param]);

        return $query[$param];
    }

    private function getAppname(RequestInterface $request): string
    {
        $path = $request->getUri()->getPath();
        $pathElems = \explode('/', $path);

        
Home | Imprint | This part of the site doesn't use cookies.