isNotNull example

/** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->andWhere($queryBuilder->expr()->neq('plugin.active', 'true'))
                ->andWhere($queryBuilder->expr()->isNotNull('plugin.installed'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        return [];
    }

    /** * {@inheritdoc} */
->andWhere($builder->expr()->eq('coreConfigValues.shop_id', $builder->createNamedParameter($shopId)))
        ;
    }

    protected function isLayerResponsible(?int $shopId): bool
    {
        $queryBuilder = $this->connection->createQueryBuilder();

        return $queryBuilder->from('s_core_shops')
            ->select('1')
            ->andWhere($queryBuilder->expr()->eq('id', ':id'))
            ->andWhere($queryBuilder->expr()->isNotNull('main_id'))
            ->setParameter('id', $shopId)
            ->execute()->fetchColumn() !== false
        ;
    }
}
case $operator === Condition::OPERATOR_EQ:
                if ($value === null) {
                    $query->andWhere($query->expr()->isNull($field));
                    break;
                }
                $query->andWhere($query->expr()->eq($field$boundParamName));
                $query->setParameter($boundParamName$value);
                break;

            case $operator === Condition::OPERATOR_NEQ:
                if ($value === null) {
                    $query->andWhere($query->expr()->isNotNull($field));
                    break;
                }
                $query->andWhere($query->expr()->neq($field$boundParamName));
                $query->setParameter($boundParamName$value);
                break;

            case $operator === Condition::OPERATOR_LT:
                $query->andWhere($query->expr()->lt($field$boundParamName));
                $query->setParameter($boundParamName$value);
                break;

            
'format',
      ])
      ->fields('lt', [
        'lid',
        'translation',
        'language',
        'plid',
        'plural',
        'i18n_status',
      ])
      ->condition('i18n.textgroup', 'menu')
      ->isNotNull('lt.lid');

    $query->addField('m', 'language', 'm_language');
    $query->leftJoin('i18n_string', 'i18n', '[i18n].[objectid] = [m].[menu_name]');
    $query->leftJoin('locales_target', 'lt', '[lt].[lid] = [i18n].[lid]');

    return $query;
  }

  /** * {@inheritdoc} */
  


    /** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->andWhere($queryBuilder->expr()->isNotNull('plugin.installed'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        return [];
    }

    /** * {@inheritdoc} */
// Add in the property, which is either title or description. Cast the mlid     // to text so PostgreSQL can make the join.     $query->leftJoin('i18n_string', 'i18n', 'CAST([ml].[mlid] AS CHAR(255)) = [i18n].[objectid]');
    $query->fields('i18n', ['lid', 'objectid', 'property', 'textgroup'])
      ->condition('i18n.textgroup', 'menu')
      ->condition('i18n.type', 'item');

    // Add in the translation for the property.     $query->innerJoin('locales_target', 'lt', '[i18n].[lid] = [lt].[lid]');
    $query->addField('lt', 'language', 'lt_language');
    $query->fields('lt', ['translation']);
    $query->isNotNull('lt.language');

    return $query;
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    if (!parent::prepareRow($row)) {
      return FALSE;
    }

    

  public function isNull($field) {
    $this->query->isNull($field);
    return $this;
  }

  /** * {@inheritdoc} */
  public function isNotNull($field) {
    $this->query->isNotNull($field);
    return $this;
  }

  /** * {@inheritdoc} */
  public function exists(SelectInterface $select) {
    $this->query->exists($select);
    return $this;
  }

  
$select->addExpression(':langcode', 'langcode', [':langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]);
    }

    // Add the delta column and set it to 0 because we are only dealing with     // single cardinality fields.     $select->addExpression(':delta', 'delta', [':delta' => 0]);

    // Add all the dynamic field columns.     $or = $select->orConditionGroup();
    foreach ($shared_table_field_columns as $field_column_name => $schema_column_name) {
      $select->addField('entity_table', $schema_column_name$dedicated_table_field_columns[$field_column_name]);
      $or->isNotNull('entity_table.' . $schema_column_name);
    }
    $select->condition($or);

    // Lock the table rows.     $select->forUpdate(TRUE);

    return $select;
  }

  /** * Checks that we are dealing with the correct entity type. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type to be checked. * * @return bool * TRUE if the entity type matches the current one. * * @throws \Drupal\Core\Entity\EntityStorageException */
$this->assertEquals('Fozzie', $names[0], 'Correct record returned for NULL age.');
  }

  /** * Tests that we can find a record without a NULL value. */
  public function testIsNotNullCondition() {
    $this->ensureSampleDataNull();

    $names = $this->connection->select('test_null', 'tn')
      ->fields('tn', ['name'])
      ->isNotNull('tn.age')
      ->orderBy('name')
      ->execute()->fetchCol();

    $this->assertCount(2, $names, 'Correct number of records found withNOT NULL age.');
    $this->assertEquals('Gonzo', $names[0], 'Correct record returned for NOT NULL age.');
    $this->assertEquals('Kermit', $names[1], 'Correct record returned for NOT NULL age.');
  }

  /** * Tests that we can force a query to return an empty result. */
  
protected function readFieldItemsToPurge(FieldDefinitionInterface $field_definition$batch_size) {
    // Check whether the whole field storage definition is gone, or just some     // bundle fields.     $storage_definition = $field_definition->getFieldStorageDefinition();
    $table_mapping = $this->getTableMapping();
    $table_name = $table_mapping->getDedicatedDataTableName($storage_definition$storage_definition->isDeleted());

    // Get the entities which we want to purge first.     $entity_query = $this->database->select($table_name, 't', ['fetch' => \PDO::FETCH_ASSOC]);
    $or = $entity_query->orConditionGroup();
    foreach ($storage_definition->getColumns() as $column_name => $data) {
      $or->isNotNull($table_mapping->getFieldColumnName($storage_definition$column_name));
    }
    $entity_query
      ->distinct(TRUE)
      ->fields('t', ['entity_id'])
      ->condition('bundle', $field_definition->getTargetBundle())
      ->range(0, $batch_size);

    // Create a map of field data table column names to field column names.     $column_map = [];
    foreach ($storage_definition->getColumns() as $column_name => $data) {
      $column_map[$table_mapping->getFieldColumnName($storage_definition$column_name)] = $column_name;
    }
// Add every column in the field's schema.       foreach ($columns as $column) {
        $query->addField('t', $field['field_name'] . '_' . $column$column);
      }

      return $query
        // This call to isNotNull() is a kludge which relies on the convention         // that field schemas usually define their most important column first.         // A better way would be to allow field plugins to alter the query         // directly before it's run, but this will do for the time being.         ->isNotNull($field['field_name'] . '_' . $columns[0])
        ->condition('nid', $node->getSourceProperty('nid'))
        ->condition('vid', $node->getSourceProperty('vid'))
        ->orderBy('delta')
        ->execute()
        ->fetchAllAssoc('delta');
    }
    else {
      return [];
    }
  }

  
protected function queryOpBoolean($field$query_operator = self::EQUAL) {
    if (empty($this->value)) {
      if ($this->accept_null) {
        if ($query_operator === self::EQUAL) {
          $condition = ($this->query->getConnection()->condition('OR'))
            ->condition($field, 0, $query_operator)
            ->isNull($field);
        }
        else {
          $condition = ($this->query->getConnection()->condition('AND'))
            ->condition($field, 0, $query_operator)
            ->isNotNull($field);
        }
        $this->query->addWhere($this->options['group']$condition);
      }
      else {
        $this->query->addWhere($this->options['group']$field, 0, $query_operator);
      }
    }
    else {
      if (!empty($this->definition['use_equal'])) {
        // Forces a self::EQUAL operator instead of a self::NOT_EQUAL for         // performance reasons.


    private function addSorting(ProductNameSorting $sorting, QueryBuilder $query, ShopContextInterface $context): void
    {
        $query->leftJoin(
            self::PRODUCT,
            's_articles_translations',
            self::TRANSLATION,
            $query->expr()->andX(
                $query->expr()->eq(self::TRANSLATION . '.articleID', self::PRODUCT . '.id'),
                $query->expr()->eq(self::TRANSLATION . '.languageID', $context->getShop()->getId()),
                $query->expr()->isNotNull(self::TRANSLATION_NAME),
                $query->expr()->neq(self::TRANSLATION_NAME, $query->expr()->literal(''))
            )
        );

        $query->addOrderBy(
            self::exprIf(
                $query->expr()->isNull(self::TRANSLATION_NAME),
                self::PRODUCT . '.name',
                self::TRANSLATION_NAME
            ),
            $sorting->getDirection()
        );

  public function isNull($field) {
    $this->condition->isNull($field);
    return $this;
  }

  /** * {@inheritdoc} */
  public function isNotNull($field) {
    $this->condition->isNotNull($field);
    return $this;
  }

  /** * {@inheritdoc} */
  public function exists(SelectInterface $select) {
    $this->condition->exists($select);
    return $this;
  }

  
/** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'plugin') {
            $repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->andWhere($queryBuilder->expr()->eq('plugin.active', 'true'))
                ->andWhere($queryBuilder->expr()->isNotNull('plugin.installed'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        return [];
    }

    /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.