Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $affected = 0;
     if (isset($this->databaseContents[$this->table])) {
         $original_row_count = count($this->databaseContents[$this->table]);
         $condition = $this->condition;
         $this->databaseContents[$this->table] = array_filter($this->databaseContents[$this->table], function ($row_array) use($condition) {
             $row = new DatabaseRow($row_array);
             return !ConditionResolver::matchGroup($row, $condition);
         });
         $affected = $original_row_count - count($this->databaseContents[$this->table]);
     }
     return $affected;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $affected = 0;
     if (isset($this->databaseContents[$this->table])) {
         $fields = $this->fields;
         $condition = $this->condition;
         array_walk($this->databaseContents[$this->table], function (&$row_array) use($fields, $condition, &$affected) {
             $row = new DatabaseRow($row_array);
             if (ConditionResolver::matchGroup($row, $condition)) {
                 $row_array = $fields + $row_array;
                 $affected++;
             }
         });
     }
     return $affected;
 }
Exemplo n.º 3
0
 /**
  * Resolves conditions by removing non-matching rows.
  *
  * @param \Drupal\Core\Database\Query\Condition $condition_group
  *   The condition group to check.
  * @param array $rows
  *   An array of rows excluding non-matching rows.
  *
  * @return \Drupal\Core\Database\Driver\fake\ConditionResolver
  *   The condition resolver object.
  */
 protected function resolveConditions(Condition $condition_group, array &$rows)
 {
     $fields_with_table = $this->fieldsWithTable;
     $fields = $this->fields;
     return array_filter($rows, function ($row_array) use($condition_group, $fields_with_table, $fields) {
         $row = new DatabaseRowSelect($row_array, $fields_with_table, $fields);
         return ConditionResolver::matchGroup($row, $condition_group);
     });
 }