解析不需要扫描的table

@param array &$tablesDisabled 不需要扫描的表
775372
private function parseDisableTablesCommand(&$tablesDisabled)
    {
        if (input()->hasSOpt('e') || input()->hasLOpt('exclude')) {
            $tablesDisabled = input()->hasSOpt('e') ? input()->getShortOpt('e') : input()->getLongOpt('exclude');
            $tablesDisabled = !empty($tablesDisabled) ? explode(',', $tablesDisabled) : [];
        }
    }
501713
private function updateTable(array $columns, Table &$table) {
        $this->updateReferences($table);
        $canUpdate = false;
        foreach ($columns['remove'] as $columnName) {
            $canUpdate = true;
            $table->dropColumn(Util::camelTo_($columnName));
        }

        foreach ($columns['update'] as $columnName => &$desc) {
            $canUpdate = true;
            $dbColumnName = Util::camelTo_($columnName);

            $this->checkIndexes($dbColumnName, $desc, $table);

            if (isset($desc['attrs']['reference'])) {
                $onDelete = (isset($desc['attrs']['reference']['onDelete'])) ?
                        $desc['attrs']['reference']['onDelete'] : 'RESTRICT';
                $onUpdate = (isset($desc['attrs']['reference']['onUpdate'])) ?
                        $desc['attrs']['reference']['onUpdate'] : 'RESTRICT';
                $table->alterReference($dbColumnName, $desc['attrs']['reference']['table'], $desc['attrs']['reference']['column'], $onDelete, $onUpdate);
                unset($desc['attrs']['reference']['table']);
                unset($desc['attrs']['reference']['column']);
                unset($desc['attrs']['reference']['model']);

                if (isset($desc['attrs']['reference']['onUpdate']))
                    unset($desc['attrs']['reference']['onUpdate']);
                if (isset($desc['attrs']['reference']['onDelete']))
                    unset($desc['attrs']['reference']['onDelete']);

                if (!empty($desc['attrs']['reference'])) {
                    $desc['attrs'] = array_merge($desc['attrs'], $desc['attrs']['reference']);
                    unset($desc['attrs']['reference']);
                }
            }

            $table->alterColumn($dbColumnName, $this->parseAttributes($columnName, $desc, false));

            if (isset($desc['attrs']['primary']) && $desc['attrs']['primary'])
                $table->setPrimaryKey($dbColumnName);
        }

        foreach ($columns['new'] as $columnName => $desc) {
            $canUpdate = true;
            $dbColumnName = Util::camelTo_($columnName);

            if (isset($desc['attrs']['reference'])) {
                $onDelete = (isset($desc['attrs']['reference']['onDelete'])) ?
                        $desc['attrs']['reference']['onDelete'] : 'RESTRICT';
                $onUpdate = (isset($desc['attrs']['reference']['onUpdate'])) ?
                        $desc['attrs']['reference']['onUpdate'] : 'RESTRICT';
                $table->addReference($dbColumnName, $desc['attrs']['reference']['table'], $desc['attrs']['reference']['column'], $onDelete, $onUpdate);
                unset($desc['attrs']['reference']['table']);
                unset($desc['attrs']['reference']['column']);
                unset($desc['attrs']['reference']['model']);

                if (isset($desc['attrs']['reference']['onUpdate']))
                    unset($desc['attrs']['reference']['onUpdate']);
                if (isset($desc['attrs']['reference']['onDelete']))
                    unset($desc['attrs']['reference']['onDelete']);

                if (!empty($desc['attrs']['reference'])) {
                    $desc['attrs'] = array_merge($desc['attrs'], $desc['attrs']['reference']);
                    unset($desc['attrs']['reference']);
                }
            }

            $table->addColumn($dbColumnName, $this->parseAttributes($columnName, $desc, false));

            $this->checkIndexes($dbColumnName, $desc, $table);

            if (isset($desc['attrs']['primary']) && $desc['attrs']['primary'])
                $table->setPrimaryKey($dbColumnName);
        }

        if ($canUpdate) {
            $droppedRefs = array();
            foreach ($table->getBackReferences() as $refArray) {
                foreach ($refArray as $ref) {
                    $refTable = new Table($ref['refTable'], $table->getConnection());
                    foreach ($refTable->getReferences() as $col => $array) {
                        if ($refTable->getName() !== $table->getName() && $array['refTable'] === $table->getName()) {
                            $refTable->dropReference($col);
                            $droppedRefs[$col][] = array_merge(array(
                                'table' => $refTable,
                                    ), $array);

                            $table->getConnection()->alterTable($refTable);
                        }
                    }
                }
            }
            $return = $table->getConnection()->alterTable($table);

            foreach ($droppedRefs as $col => $array) {
                foreach ($array as $ref) {
                    $onDelete = (!empty($ref['onDelete'])) ? $ref['onDelete'] : 'RESTRICT';
                    $onUpdate = (!empty($ref['onUpdate'])) ? $ref['onUpdate'] : 'RESTRICT';
                    $ref['table']->addReference($col, $ref['refTable'], $ref['refColumn'], $onDelete, $onUpdate);

                    $table->getConnection()->alterTable($ref['table']);
                }
            }
            if ($return) {
                $table->getConnection()->flush();
                return true;
            }
        }

        return false;
    }
925914
public function table(Table\Table $table)
    {

        // Headers
        $head = '';
        $headers = [];
        $hasStrainer = false;
        foreach($table->getColumns() as $column) {
            /** @var Column\Column $column */
			$label = $column->getLabel();
			if ($column->hasDescription()) {
				$label .= ' <i class="fa fa-question-circle" data-toggle="tooltip" title="'.$column->getDescription().'"></i>';
			}
            $head .= html('th', ['class' => 'text-center'], $label);
            $headers[] = $column->getName();
            $hasStrainer = $hasStrainer || $column->hasStrainer();
        }

        $head = html('tr', ['class' => 'heading'], $head);


        // Strainer
        if ($hasStrainer) {

            // initialisation des strainer
            $strainer = '';
            foreach($table->getColumns() as $column) {
                /** @var Column\Column $column */
                $content = '';
                if ($column->hasStrainer()) {
                    $content = $column->getStrainer()->render();
                }

                $strainer .= html('th', ['class' => 'text-center'],$content);
            }

            $head .= html('tr', ['class' => 'filter'], $strainer);
        }

        // Data
        $body = '';
        foreach($table->getRows() as $row) {

            $line = '';
            foreach($table->getColumns() as $name => $column) {

                $attributes = $column->getAttributes();
                if ($table->hasIdField()) {

                    if (!isset($row[$table->getIdField()])) {
                        throw new \LogicException($table->getIdField() . ' column is not found');
                    }

                    //too soon for you
//                  $attributes['data-id'] = sprintf('%s#%s', $row[$table->getIdField()], $name);
                }

                // remove class in colum because it set in column for datatable
                if ($table->isDatatable()) {
                    unset($attributes['class']);
                }

                $line .= html('td', $attributes, $column->render((array) $row)) . PHP_EOL;
            }

            $body .= html('tr', [],$line );
        }

		// Footer
		$footer = '';

        if ($table->isDatatable()) {
            $this->render('datatable', $table);
        } elseif ($table->hasFooter()) {
			$current = $table->getPage();
			$footer .= sprintf('<li class="disabled"><span>&laquo;</span></li>');
			for ($i = 1; $i <= min(10, $table->getPagesTotal()); $i++) {
				$footer .= html('li', ['class' => $current == $i ? 'active' : null], sprintf('<a href="%s">%s</a>', $table->getPageUrl($i), $i));
			}

			$footer .= sprintf('<li><a href="%s" rel="next">&raquo;</a></li>', '#');
			$footer = html('ul', ['class' => 'pagination'], $footer);
			$footer = html('td', ['colspan' => count($headers)], $footer);
			$footer = html('tr', [], $footer);
			$footer = html('tfoot', ['class' => 'text-center'], $footer);
		}


        // Bootstrap class management
        $table->addClass(Style::TABLE_CLASS);

        if ($table->isStriped()){
            $table->addClass(Style::TABLE_CLASS_STRIPED);
        }

        if ($table->isBordered()) {
            $table->addClass(Style::TABLE_CLASS_BORDERED);
        }

        if ($table->isCondensed()) {
            $table->addClass(Style::TABLE_CLASS_CONDENSED);
        }

        if ($table->hasHover()) {
            $table->addClass(Style::TABLE_CLASS_HOVER);
        }


        $html =  html('table', $table->getAttributes(), html('thead', [], $head) . html('tbody', [], $body) . $footer);

        // responsive
        if ($table->isResponsive()){
            $html = html('div', ['class' => Style::TABLE_CLASS_RESPONSIVE], $html);
        }

        if ($table->hasPanel()) {
            $html = $table->getPanel()->setBody($html)->render();
        }

        return $html;
    }
833268
protected function findIndexesForTableConditions(
        array $conditions,
        TableInterface $table,
        $tableName
    ) {
        $indexes = array();

        /* @var $tableSchema TableSchema */
        $tableSchema = $table->getTableSchema();

        $conditionColumns = array();

        foreach ($conditions as $condition) {
            /* @var $condition ConditionJob */

            $column = $condition->getFirstParameter();
            $fixedValue = $condition->getLastParameter();

            if ($fixedValue instanceof ColumnSpecifier) {
                list($column, $fixedValue) = [$fixedValue, $column];
            }

            if ($column instanceof ColumnSpecifier) {
                /* @var $column ColumnSpecifier */

                if (is_null($column->getTable()) || $column->getTable() === $tableName) {
                    $columnId = $tableSchema->getColumnIndex($column->getColumn());

                    if (is_int($columnId) && $columnId >= 0) {
                        $conditionColumns[$column->getColumn()] = $columnId;
                    }
                }
            }
        }

        if (!empty($conditionColumns)) {
            foreach ($tableSchema->getIndexIterator() as $indexId => $indexSchema) {
                /* @var $indexSchema IndexSchema */

                $indexColumns = $indexSchema->getColumns();

                if (empty(array_diff($indexColumns, $conditionColumns))) {
                    /* @var $index IndexInterface */
                    $index = $table->getIndex($indexId);

                    $indexes[] = $index;
                }
            }
        }

        return $indexes;
    }
1189748
public function excludeTables($excludeTables)
    {
        if (! empty($this->includeTables)) {
            throw CannotSetParameter::conflictingParameters('excludeTables', 'includeTables');
        }

        if (! is_array($excludeTables)) {
            $excludeTables = explode(', ', $excludeTables);
        }

        $this->excludeTables = $excludeTables;

        return $this;
    }
1282307
protected function whitelistTable($table) {
        if(is_array($table)) {
            foreach ($table as $t) {
                $this->query->addToTableWhitelist($t);
            }
        }
        else {
            $this->query->addToTableWhitelist($table);
        }
    }
172465
public function from($tables)
    {
        if (is_array($tables)) {
            $this->from = $tables;
        } else {
            $this->from = array($tables);
        }
        return $this;
    }
1090862
public function updateTable($table, ...$tables)
    {
        $instance = $this->updateQueryInstance();

        $instance->updateQuery()->table($table, ...$tables);

        return $instance;
    }
954351
public function table($tables)
    {
        if (!is_array($tables)) {
            // because a single table is converted to an array anyways,
            // this makes sense.
            $tables = func_get_args();
        }

        $instance = new static($this->connection, $this->getFetchMode());
        $tables = $this->addTablePrefix($tables, false);
        $instance->addStatement('tables', $tables);
        return $instance;
    }
309313
private function _prepareJoinTable(array $tables)
	{
		$this->tables = ' ';
		foreach($tables as $tableObj)
		{
			$this->tables .= $tableObj->getExpression() . ', ';
		}
		$this->tables = rtrim(rtrim($this->tables), ',') . ' ';
	}
554543
public function removeDisallowedWizardItems(array $allowed, array $disallowed, array &$wizardItems)
    {
        foreach ($wizardItems as $key => $wizardItem) {
            if (!$wizardItems[$key]['header']) {
                if (
                    (
                        !empty($allowed['CType']) &&
                        !isset($allowed['CType'][$wizardItems[$key]['tt_content_defValues']['CType']]) &&
                        !isset($allowed['CType']['*'])
                    ) ||
                    (
                        !empty($disallowed) && (
                            isset($disallowed['CType'][$wizardItems[$key]['tt_content_defValues']['CType']]) ||
                            isset($disallowed['CType']['*'])
                        )
                    ) ||
                    (
                        isset($wizardItems[$key]['tt_content_defValues']['list_type']) &&
                        !empty($allowed['list_type']) &&
                        !isset($allowed['list_type'][$wizardItems[$key]['tt_content_defValues']['list_type']]) &&
                        !isset($allowed['list_type']['*'])
                    ) ||
                    (
                        isset($wizardItems[$key]['tt_content_defValues']['list_type']) &&
                        !empty($disallowed) && (
                            isset($disallowed['list_type'][$wizardItems[$key]['tt_content_defValues']['list_type']]) ||
                            isset($disallowed['list_type']['*'])
                        )
                    )
                ) {
                    unset($wizardItems[$key]);
                }
            }
        }
    }
827192
private function throwTableExceptions($tables, $requestedTables)
    {
        $foundTables = [];
        foreach ($tables as $table) {
            $foundTables[] = $table['name'];
        }

        foreach ($requestedTables as $requestedTable) {
            if (array_search($requestedTable, $foundTables) === false) {
                throw new exceptions\TableNotFoundException($requestedTable
                    ? "$requestedTable not found on target database."
                    : 'Please specify a table name.'
                );
            }
        }
    }
838148
public void setDisabled(boolean disabled) {
		this.disabled = disabled;
		if (disabled) {
			handlerManager.fireEvent(new ToolbarActionDisabledEvent());
		} else {
			handlerManager.fireEvent(new ToolbarActionEnabledEvent());
		}
	}
90352
public function queriedTables()
    {
        $tables = array();

        foreach ($this->from as $key => $tableClause) {
            if (is_array($tableClause)) {
                $table = '"' . $tableClause['table'] . '"';
            } elseif (is_string($tableClause) && preg_match('/JOIN +("[^"]+") +(AS|ON) +/i', $tableClause, $matches)) {
                $table = $matches[1];
            } else {
                $table = $tableClause;
            }

            // Handle string replacements
            if ($this->replacementsOld) {
                $table = str_replace($this->replacementsOld, $this->replacementsNew, $table);
            }

            $tables[] = preg_replace('/^"|"$/', '', $table);
        }

        return $tables;
    }
697815
protected function makeTable($table): ?Table
    {
        // 如果是字符串,那么应该是表名,创建表对象
        if (is_string($table)) {
            return table($table);
        }

        // 如果已经是表对象,返回
        if ($table instanceof Table) {
            return $table;
        }

        return null;
    }
483198
private function _prepareTables(array $tablesArray)
	{
		if(count($tablesArray) === 0)
		{
			throw new \Exception('"table"-method of the statement have to invoked before!');
		}

		$tables = ' ';
		foreach($tablesArray as $table)
		{
			$tables .= $table->getExpression() . ', ';
		}
		$tables       = substr($tables, 0, strlen($tables) - 2);
		$this->tables = $tables . ' ';
	}
599095
public function excludeTables(array $tables)
    {
        if (is_array($tables) && count($tables) > 0)
        {
            $this->excludedTables = $tables;
        }

        return $this;
    }