Sets the table this document is mapped to.

@param array|string $table The table name.

@throws \InvalidArgumentException
348161
public function setTable($table)
    {
        if (is_array($table)) {
            if (!isset($table['name'])) {
                throw new \InvalidArgumentException('A name key is required when passing an array to setTable()');
            }
            $this->table = $table['name'];
        } else {
            $this->table = $table;
        }
    }
1111303
public function setColumns( $columns ){
		if( !( is_array( $columns ) && count( $columns ) ) )
			throw new \InvalidArgumentException( 'Column array must not be empty' );
		$this->columns = $columns;
	}
579318
public function setTable($table)
    {
        $this->table = $table;
        $this->getQuery()->table($table);

        return $this;
    }
1070254
public function setTable(Table $table = null)
    {
        $this->table = $table;

        if ($table && !in_array($this, $table->getRows())) {
            $table->addRow($this);
        }

        return $this;
    }
65629
public function setTables($tables) {
		foreach($tables as $key=>$value) {
			if (is_numeric($key)) {
				$this->tables[] = $value;
			}
			else {
				$this->tables[] = $key;
				$this->columns[$key] = $value;
			}
		}
		$this->cacheTables = true;
	}
319543
public function init(Table &$table) {
        $this->_table = & $table;
        $className = str_replace('\\', '.', get_called_class());
        $path = DATA . 'mapper' . DIRECTORY_SEPARATOR . $className;
        $save = false;

        @session_start();
        if (@$_SESSION['mapperSave'] && !is_readable($path)) {
            $this->save($path, $this->getClassSettings());
            unset($_SESSION['mapperSave']);
        }

        if (!$this->tableExists($table)) {
            $save = $this->createTable($table);
        }
        else {
            $this->checkModelRequirements();
            $save = $this->isUpToDate($path, $table);
        }

        if ($save || !is_readable($path))
            $this->save($path, $this->getClassSettings());
    }
475305
public function setTables(array $tables)
    {
        $this->tables = array();

        foreach ($tables as $table) {
            $this->addTable($table);
        }
    }
56010
public function from($table)
    {
        if ($this->tableReadOnly) {
            throw new Exception\InvalidArgumentException(
                'Since this object was created with a table and/or schema in the constructor, it is read only.'
            );
        }

        if (!is_string($table) &&
            !is_array($table) &&
            !$table instanceof TableIdentifier &&
            !$table instanceof Select
        ) {
            throw new Exception\InvalidArgumentException(
                '$table must be a string, array, an instance of TableIdentifier, or an instance of Select'
            );
        }

        if ($table instanceof TableIdentifier) {
            $table = $table->getTable(); // Ignore schema because it is not supported by SphinxQL
        }

        $this->table = $table;

        return $this;
    }
206126
public function addTable(Table $table)
    {
        if ($this->hasTable($table->getName())) {
            throw SchemaException::schemaTableAlreadyExists($this->getName(), $table->getName());
        }

        $this->tables[$table->getName()] = $table;

        if ($table->getSchema() !== $this) {
            $table->setSchema($this);
        }
    }
361363
public function clearTable($table)
    {
        $this->query("DELETE FROM \"$table\"");

        // Check if resetting the auto-increment is needed
        $autoIncrement = $this->preparedQuery(
            'SELECT "AUTO_INCREMENT" FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?',
            [ $this->getSelectedDatabase(), $table]
        )->value();

        if ($autoIncrement > 1) {
            $this->query("ALTER TABLE \"$table\" AUTO_INCREMENT = 1");
        }
    }
1269570
public function initialize(Table $table)
    {
        $this->table = $table;
        $this->table->isProcessing(true);
        $this->table->isServerSide(true);

        if (!is_null($this->ajax)) {
            $this->table->setAjax($this->ajax);
        }
    }
373274
public function into($table = null): Insert
    {
        $this->into = [];
        if (!\is_string($table) && !\is_array($table)) {
            throw new InvalidArgumentException('$table has to be an array or a string');
        }
        $this->into = $this->namesClass->parse($table, true);

        return $this;
    }
866022
public function insert($table, $data) {
        if (!$this->validateTableAndCol($table, array_keys($data))) {
            throw new \InvalidArgumentException ('Table or coloumn information is incorrect acorrding to the contract');
        }

        if ($data && !$this->validateBind($table, $data)) {
            throw new \InvalidArgumentException ('Input data is incorrect acorrding to the contract');
        }

        $result = $this->db_adapter->insert($table, $data);
        if (!$result) {
            throw new \InvalidArgumentException ($this->db_adapter->getLastError());
        }   

        return $result;
    }
1091333
public function setTable($table)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        $this->table = $table;
        
        //for each row
        foreach ($this->list as $row) {
            if (!is_object($row) || !method_exists($row, __FUNCTION__)) {
                continue;
            }
            
            //let the row handle this
            $row->setTable($table);
        }
        
        return $this;
    }
181345
public function setTable(string $table): self
    {
        $this->table = $this->agent->escapeIdentifier($table);

        return $this;
    }
440456
protected function setFields($fields)
    {
        if(is_array($fields)) {
            foreach ( $fields as $field ) {
                if ( !in_array($field, $this->fieldsWhitelist) ) {
                    throw new \InvalidArgumentException(sprintf('The field `%s` was not recognized.', $field));
                }
            }
        } elseif($fields === true) {
            $fields = $this->fieldsWhitelist;
        } else {
            throw new \InvalidArgumentException("The argument passed to setFields was invalid");
        }

        $this->setQueryParam('fields', $fields);
    }
360769
private function setKeyForTable($table, $key)
    {
        $this->validateTableName($table);
        $this->validateKeyName($key);
        $this->tableKeys[$table] = $key;
    }