members example

 $access_condition;
      $filter = new Filter($prefixed_condition);
      $query->condition($filter->queryCondition($query));
    }
  }

  /** * Prefixes all fields in an EntityConditionGroup. */
  protected static function addConditionFieldPrefix(EntityConditionGroup $group$field_prefix) {
    $prefixed = [];
    foreach ($group->members() as $member) {
      if ($member instanceof EntityConditionGroup) {
        $prefixed[] = static::addConditionFieldPrefix($member$field_prefix);
      }
      else {
        $field = !empty($field_prefix) ? "{$field_prefix}." . $member->field() : $member->field();
        $prefixed[] = new EntityCondition($field$member->value()$member->operator());
      }
    }
    return new EntityConditionGroup($group->conjunction()$prefixed);
  }

  
 $painting))->save();
    }
  }

  /** * @covers ::createFromQueryParameter * @dataProvider parameterProvider */
  public function testCreateFromQueryParameter($case$expected) {
    $resource_type = new ResourceType('foo', 'bar', NULL);
    $actual = Filter::createFromQueryParameter($case$resource_type$this->getFieldResolverMock($resource_type));
    $conditions = $actual->root()->members();
    for ($i = 0; $i < count($case)$i++) {
      $this->assertEquals($expected[$i]['path']$conditions[$i]->field());
      $this->assertEquals($expected[$i]['value']$conditions[$i]->value());
      $this->assertEquals($expected[$i]['operator']$conditions[$i]->operator());
    }
  }

  /** * Data provider for testCreateFromQueryParameter. */
  public function parameterProvider() {
    
class EntityConditionGroupTest extends UnitTestCase {

  /** * @covers ::__construct * @dataProvider constructProvider */
  public function testConstruct($case) {
    $group = new EntityConditionGroup($case['conjunction']$case['members']);

    $this->assertEquals($case['conjunction']$group->conjunction());

    foreach ($group->members() as $key => $condition) {
      $this->assertEquals($case['members'][$key]['path']$condition->field());
      $this->assertEquals($case['members'][$key]['value']$condition->value());
    }
  }

  /** * @covers ::__construct */
  public function testConstructException() {
    $this->expectException(\InvalidArgumentException::class);
    new EntityConditionGroup('NOT_ALLOWED', []);
  }
    switch ($condition_group->conjunction()) {
      case 'AND':
        $group = $query->andConditionGroup();
        break;

      case 'OR':
        $group = $query->orConditionGroup();
        break;
    }

    // Get all children of the group.     $members = $condition_group->members();

    foreach ($members as $member) {
      // If the child is simply a condition, add it to the new group.       if ($member instanceof EntityCondition) {
        if ($member->operator() == 'IS NULL') {
          $group->notExists($member->field());
        }
        elseif ($member->operator() == 'IS NOT NULL') {
          $group->exists($member->field());
        }
        else {
          
Home | Imprint | This part of the site doesn't use cookies.