Insert of field at a specific index
@param  NamedBuilder|NamedBuilder[] $fields a single field or an array of fields
@param  int $index  insertion point
@return void
353018
public function insertFields($fields, $index)
    {
        if (!$fields instanceof NamedBuilder && !is_array($fields)) {
            return;
        }

        // If a singular field config, put into an array of fields
        if ($fields instanceof NamedBuilder) {
            $fields = [$fields];
        }


        foreach ($fields as $i => $field) {
            if ($this->validateField($field)) {
                array_splice($this->fields, $index + $i, 0, [$field]);
            }
        }
    }
1173093
private function fieldPrefixer(array &$fields)
    {
        foreach ($fields as $index => $property) {
            if (0 === \strpos($property, $this->source . '.')
                || !$this->fieldExists($property)
            ) {
                continue;
            }

            $fields[$index] = $this->source . '.' . $property;
        }
    }
1299555
public function insertInList(array $values, $index, $value)
    {
        for ($i=count($values); $i < $index; $i++) {
            $values[$i] = null;
        }

        $values[$index] = $value;

        return $values;
    }
850182
public function setIndex($index)
    {
        if ($this->index !== $index) {
            $this->index = $index;
            $this->addOrUpdate();
        }
    }
1162058
public function addIndex($indexName) {
    if (is_array($indexName)) {
      $this->indexes = $indexName;
    } else {
      $this->indexes[] = $indexName;
    }
    $this->indexes = array_unique($this->indexes);
  }
95098
public function addSecondaryIndex(Index $index)
    {
        if ($this->isEmbeddedDocument) {
            throw MappingException::embeddedDocumentsNotIndexable($this->getName());
        }

        if (isset($this->secondaryIndexes[$index->getName()])) {
            throw MappingException::indexExists($this->getName(), $index->getName());
        }

        $this->secondaryIndexes[$index->getName()] = $index;
    }
581344
public function save(Indexation $index)
    {
        $existing = $this->find([
            '_content' => $index->getContent(),
            '_field' => $index->getField(),
        ]);

        if (null === $existing) {
            $existing = $index;
            $this->getEntityManager()->persist($existing);
        } else {
            $existing->setValue($index->getValue());
        }

        $metadata = $this->getEntityManager()->getClassMetadata('BackBee\ClassContent\Indexation');
        $this->getEntityManager()
                ->getUnitOfWork()
                ->computeChangeSet($metadata, $existing);
    }
4590
public function replaceField($name, $field)
    {
        $index = $this->getFieldIndex($name);
        $this->removeFieldAtIndex($index);
        $this->insertFields($field, $index);
    }
1292834
public function setIndexes(array $indexes)
    {
        $this->indexes = array();

        foreach ($indexes as $index) {
            $this->addIndex($index);
        }
    }
525960
public function addFields($fields)
    {
        foreach ($fields as $field) {
            if (is_array($field)) {
                $this->addField(...$field);
            } else {
                $this->addField($field);
            }
        }

        return $this;
    }
433374
protected function insertInternal(array $fields = [])
    {
        $dirty = $this->getDirtyAttributes();

        $values = $this->getChangedAttributes($fields);
        if (empty($values)) {
            return true;
        }

        $connection = static::getConnection();
        $qb = $this->getQueryBuilder();

        $tableName = $qb->getQuotedName(TableNameResolver::getTableName($this->tableName()));
        $sql = $qb
            ->insert()
            ->table($tableName)
            ->values($values)
            ->toSQL();
        $inserted = $connection->executeUpdate($sql);
        if (false === $inserted) {
            return false;
        }

        foreach (self::getMeta()->getPrimaryKeyName(true) as $primaryKeyName) {
            if (
                empty($this->getAttribute($this->getSequenceName())) ||
                false === in_array($primaryKeyName, $dirty)
            ) {
                $values[$primaryKeyName] = $connection->lastInsertId($this->getSequenceName());
            }
        }

        $this->setAttributes($values);

        return true;
    }
632798
public function setFields( $fields )
	{
		if( is_array( $fields ) && count( $fields ) )
			$this->fields = $fields;
		else
			trigger_error( 'Field Array of Table Definition must no be empty.', E_USER_ERROR );
	}
75444
protected function addField(Field $field)
    {
        if ($this->hasField($field->getName())) {
            throw new \Exception(
                'Field already defined for name: ' . $field->getName()
            );
        }

        $index = count($this->fields);

        $this->fieldsNameIndex[$index] = $field->getName();
        $this->fields[] = $field;
    }
94377
private ResourceField selectField(ResourceField[] fields, int index)
   {
      if (index < 1 || index > fields.length)
      {
         throw new IllegalArgumentException(index + " is not a valid field index");
      }
      return (fields[index - 1]);
   }
76098
function setColumn($index, $params)
	{
		if (isset($this->columns[$index])) $this->columns[$index] = array_merge($this->columns[$index], $params);
		else $this->columns[$index] = $params;
	}
1082436
public function sanitizeConditionalValues(&$values, $fields, $index)
    {
        foreach ($fields as $key => $field) {
            if ($values === $index) {
                $this->sanitizeValues($values[$index][$field->getSlug()], $field);
            }
        }
    }
1168308
protected function setMapping(Index $index, $lang = 'en')
    {
        $mapping = $this->createDefaultSearchFieldsMapping($index, $lang);
        $mapping->send();
        $index->refresh();
    }