Adds an index

@param string $property
@param CrestApps\CodeGenerator\Models\Index $index

@return $this
424287
protected function addIndex(&$property, Index $index)
    {
        $property .= sprintf("('%s')", $this->getPropertyBase($index->getType), $index->name);

        return $this->addFieldPropertyClousure($property);
    }
50173
final public function addUnique(Unique $index): Table
    {
        if ($this->hasUnique($index::getName())) {
            throw new InvalidArgumentException('Foreign key '.$index::getName().' already exists in the table '.$this::getName());
        }

        $this->uniques[$index::getName()] = $index;

        return $this;
    }
1363434
public function withIndex(Fluent $index)
    {
        $this->indexes[] = $index;

        if ($index->name == 'unique') {
            $this->unique[] = $index;
        }

        return $this;
    }
545923
public function set($index, $element)
    {
        if (null === $index) {
            $this->collections[] = $element;
        } else {
            $this->collections[$index] = $element;
        }

        return $this;
    }
756003
public function addPropertyValues($property,$values){
		if(\is_array($values)===false){
			$values=\array_fill(0, $this->count(),$values);
		}
		foreach ($values as $i=>$value){
			if(isset($this->content[$i])){
				$this->content[$i++]->addToProperty($property,$value);
			}
			else{
				return $this;
			}
		}
		return $this;
	}
637324
public function addProperties($properties)
    {
        foreach ($properties as $key => $value) {
            $this->setProperty($key, $value);
        }

        return $this;
    }
2977
public function set($index, $value) : Vector
    {
        $values = $this->_set($index, $value, true);
        $this->setValues($values);
        return $this;
    }
1162058
public function addIndex($indexName) {
    if (is_array($indexName)) {
      $this->indexes = $indexName;
    } else {
      $this->indexes[] = $indexName;
    }
    $this->indexes = array_unique($this->indexes);
  }
868408
public function setIndex($index): self
    {
        if ($index instanceof Index) {
            $index = $index->getName();
        }
        $this->_metadata['_index'] = $index;

        return $this;
    }
838784
public function set($index, $newValue) {
        if (!$this->offsetSet($index, $newValue)) {
            $this->append($newValue);
        }

        return $this;
    }
162172
protected function setValue($index, $value)
    {
        if (gettype($value) === 'object') {
            $this->values[$index] = $value;
        } else {
            $class_name = $this->fields[$index];
            $real_class_name = __NAMESPACE__ . "\\" . $class_name;
            $this->values[$index] = new $real_class_name();
            $this->values[$index]->value = $value;
        }
        return $this;
    }
802085
public function addProperty(Property $property)
    {
        $fieldName = $property->getName();

        // Check for empty field name
        if (empty($fieldName)) {
            throw MappingException::missingFieldName($this->className);
        }

        $property->setDeclaringClass($this);

        switch (true) {
            case $property instanceof VersionFieldMetadata:
                $this->validateAndCompleteFieldMapping($property);
                $this->validateAndCompleteVersionFieldMapping($property);
                break;

            case $property instanceof FieldMetadata:
                $this->validateAndCompleteFieldMapping($property);
                break;

            case $property instanceof OneToOneAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToOneAssociationMetadata($property);
                $this->validateAndCompleteOneToOneMapping($property);
                break;

            case $property instanceof OneToManyAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToManyAssociationMetadata($property);
                $this->validateAndCompleteOneToManyMapping($property);
                break;

            case $property instanceof ManyToOneAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToOneAssociationMetadata($property);
                $this->validateAndCompleteManyToOneMapping($property);
                break;

            case $property instanceof ManyToManyAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToManyAssociationMetadata($property);
                $this->validateAndCompleteManyToManyMapping($property);
                break;

            default:
                // Transient properties are ignored on purpose here! =)
                break;
        }

        $this->addDeclaredProperty($property);
    }
628319
public function addProperties($properties)
    {
        if (empty($properties) || !count((array)$properties)) {
            throw new \Exception('Empty properties given');
        }

        if (!is_array($properties) && !is_object($properties)) {
            throw new \Exception('Expected array or object');
        }

        foreach ($properties as $key => $property) {
            $this->addProperty($key, $property);
        }

        return $this;
    }
232959
public function addProperty(Property $property): void
    {
        $this->properties[(string) $property->getFqsen()] = $property;
    }
85750
public function addRule($index, $method = null, ...$params)
    {
        $this->rules[$index] = [$method, $params];
        return $this;
    }
599530
public function addProperty($str_name, $int_type = self::PROPERTY_STRING, $bol_index = TRUE)
    {
        $this->arr_defined_properties[$str_name] = [
            'type' => $int_type,
            'index' => $bol_index
        ];
        return $this;
    }
1146404
public function addIndex($index)
    {
        if ($index instanceof Index) {
            $index = $index->getName();
        }

        if (!\is_scalar($index)) {
            throw new InvalidException('Invalid param type');
        }

        $this->_indices[] = (string) $index;

        return $this;
    }