Exemplo n.º 1
0
 public final function setIndexObject(Index $index) : TableInterface
 {
     if ($this->isImmutable()) {
         throw SchemaException::immutable(static::class);
     }
     if ($this->hasIndex($index->getName())) {
         throw SchemaException::indexAlreadySet(static::class, $index->getName());
     }
     $missing = array_diff($index->getColumns(), array_keys($this->getColumns()));
     if ($missing !== []) {
         throw TableException::columnNotSet(static::class, implode(', ', $missing));
     }
     $this->indexes[$index->getName()] = $index;
     return $this;
 }