Returns true, if the actual node is a model table.
@return bool
963721
public function isModelTable()
    {
        return ($this->nodeType === \XMLReader::ELEMENT) && $this->hasAttributes &&
        ($this->getAttribute('struct-name') === 'db.mysql.Table') && $this->name === 'value';
    }
476983
protected function hasValidTable()
	{
		return (isset($this->table) && count($this->table['rows']) > 2 && $this->isValidSeparator($this->table['rows'][1]['line']));
	}
263513
public function isSupported()
    {
        $row = $this->getMixer();

        if($row instanceof DatabaseRowInterface)
        {
            if(!$row->hasProperty($this->_parent_column))  {
                return false;
            }
        }

        return true;
    }
1121903
public function isSection() {
		if ($this->isCurrent()) {
			return true;
		}
		$ancestors = $this->getAncestors();
		if (Director::get_current_page() instanceof Page) {
			$node = Director::get_current_page()->asMenuItem();
			if ($node) {
				$ancestors = $node->getAncestors();
				return $ancestors && in_array($this->ID, $node->getAncestors()->column());
			}
			
		}
		return false;
	}
1331534
private function isTranslatableFieldNode()
    {
        $isTranslatableField = false;
        if (isset($this->mapping[$this->className]) &&
            in_array($this->getDocumentFieldName(), $this->mapping[$this->className])
        ) {
            $isTranslatableField = true;
        }

        return $isTranslatableField;
    }
700603
public function hasRealContent()
    {
        if (count($this->contentAttributes) > 0) return true;

        foreach ($this->childNodes as $node) {
            if (!$node instanceof PHPTAL_Dom_Text || $node->getValueEscaped() !== '') return true;
        }
        return false;
    }
1202302
public function isSupported()
    {
        $table = $this->getMixer();

        //Only check if we are connected with a table object, otherwise just return true.
        if($table instanceof DatabaseTableInterface)
        {
            if(!$table->hasColumn('modified_by') && !$table->hasColumn('modified_on')) {
                return false;
            }
        }

        return true;
    }
117611
public function alterTable()
    {
        if ($this->tableExists() === false) {
            return false;
        }

        $dbh    = $this->db();
        $table  = $this->table();
        $fields = $this->getModelFields($this->model());
        $cols   = $this->tableStructure();
        foreach ($fields as $field) {
            $ident = $field->ident();

            if (!array_key_exists($ident, $cols)) {
                // The key does not exist at all.
                $query = 'ALTER TABLE `'.$table.'` ADD '.$field->sql();
                $this->logger->debug($query);
                $dbh->query($query);
            } else {
                // The key exists. Validate.
                $col   = $cols[$ident];
                $alter = true;
                if (strtolower($col['Type']) !== strtolower($field->sqlType())) {
                    $alter = true;
                }

                if ((strtolower($col['Null']) === 'no') && !$field->allowNull()) {
                    $alter = true;
                }

                if ((strtolower($col['Null']) !== 'no') && $field->allowNull()) {
                    $alter = true;
                }

                if ($col['Default'] !== $field->defaultVal()) {
                    $alter = true;
                }

                if ($alter === true) {
                    $query = 'ALTER TABLE `'.$table.'` CHANGE `'.$ident.'` '.$field->sql();
                    $this->logger->debug($query);
                    $dbh->query($query);
                }
            }
        }

        return true;
    }
454523
public function checkTableExists($model)
    {
        if (!in_array($model->table, $this->getAuditTables())) {
            $model->addError('table', Yii::t('app', "You've entered an invalid table name."));
            return false;
        }
        return true;
    }
1092396
protected function checkForTranslatedTable() : bool
    {
        $main_table = $this->getStorageDescriptor();
        if (!nb_strEndsWith($this->table_name, NABU_LANG_TABLE_SUFFIX) &&
            $main_table->hasPrimaryConstraint() &&
            ($child_table = $this->db_syntax->describeStorage(
                $this->table_name . NABU_LANG_TABLE_SUFFIX, $this->schema_name)
            ) !== null &&
            $child_table->hasPrimaryConstraint() &&
            $child_table->getPrimaryConstraintSize() === $main_table->getPrimaryConstraintSize() + 1
        ) {
            $key_diff = array_diff(
                $child_table->getPrimaryConstraintFieldNames(),
                $main_table->getPrimaryConstraintFieldNames()
            );
            $this->is_translated = (count($key_diff) === 1 && array_shift($key_diff) === NABU_LANG_FIELD_ID);
        }

        return $this->is_translated;
    }
1357642
public function showSchemaInTable()
    {
        //change connection if provide
        if ($this->option('c')) {
            $this->schema->setConnection($this->option('c'));
            $this->schema->switchWrapper();
        }

        $tables = $this->schema->databaseWrapper->getTables();
        $headers = $this->schema->headers;

        if (!count($tables)) {
            $this->warn('Database does not contain any table');
        }

        $tableName = $this->option('t');
        if ($tableName) {
            if ($this->isNamespaceModel($tableName)) {
                $tableName = $this->tableNameFromModel($tableName);
            }
            if (!in_array($tableName, $tables)) {
                $this->warn('Table name is not correct!');
                return false;
            }

            $body = $this->schema->databaseWrapper->getColumns($tableName);
            $rowsCount = $this->schema->getTableRowCount($tableName);
            $this->info($tableName . ' (rows: ' . $rowsCount . ')');
            $this->table($headers, $body);
            return true;
        }

        foreach ($this->schema->databaseWrapper->getSchema() as $key => $value) {
            $this->info($key . ' (rows: ' . $value['rowsCount'] . ')');
            $this->table($headers, $value['attributes']);
            $this->line('');
        }
    }
553342
public function hasTabs(): bool
    {
        if ( ! $this->layout || ! count($this->layout)) {
            return false;
        }

        foreach ($this->layout as $key => $value) {

            if ($value instanceof ModelFormTabDataInterface) {
                return true;
            }
        }

        return false;
    }
228104
protected function isRelationTable($table)
	{
		$pk=$table->primaryKey;
        $count=is_array($pk) ? count($pk) : 1;
        return ($count === 2 // we want 2 columns
			&& isset($table->foreignKeys[$pk[0]]) // pk column 1 is also a foreign key
			&& isset($table->foreignKeys[$pk[1]]) // pk column 2 is also a foriegn key
			&& $table->foreignKeys[$pk[0]][0] !== $table->foreignKeys[$pk[1]][0]); // and the foreign keys point different tables
	}
810498
protected function detectRelationTable($table): bool
    {
        $foreignKeys = $table->getForeignKey();
        if (count($foreignKeys) != 2) {
            return false;
        }
        $tables = [];
        foreach ($foreignKeys as $foreignKey) {
            if (!$foreignKey->hasMany()) {
                return false;
            }
            $tables[] = $foreignKey->getReferenceTableName();
        }
        if ($table->getName() === implode('_', [singularize($tables[0]), $tables[1]])
            || $table->getName() === implode('_', [singularize($tables[1]), $tables[0]])) {
            return true;
        }

        return false;
    }
497291
public static function table()
	{
		$class = get_called_class();

		// Table name unknown
		if ( ! array_key_exists($class, static::$_table_names_cached))
		{
			// Table name set in Model
			if (property_exists($class, '_table_name'))
			{
				static::$_table_names_cached[$class] = static::$_table_name;
			}
			else
			{
				static::$_table_names_cached[$class] = \Inflector::tableize($class);
			}
		}

		return static::$_table_names_cached[$class];
	}
667061
private function checkLogModels()
	{
		if (empty($this->Logger) && !empty(AuditableConfig::$Logger)) {
			$this->Logger = AuditableConfig::$Logger;
		}

		if (!($this->Logger instanceof Model)) {
			return false;
		}

		if ($this->Logger->Behaviors->attached('Auditable')) {
			$this->Logger->Behaviors->unload('Auditable');
		}

		if (!isset($this->Logger->LogDetail)) {
			return false;
		}

		if ($this->Logger->LogDetail->Behaviors->attached('Auditable')) {
			$this->Logger->LogDetail->Behaviors->unload('Auditable');
		}

		return true;
	}
934795
public function isTree()
    {
        try {
            $root = $this->getVertexRoot();
        }
        catch (UnderflowException $e) {
            return false;
        }
        catch (UnexpectedValueException $e) {
            return false;
        }

        try {
            $num = count($this->getVerticesSubtree($root));
        }
        catch (UnexpectedValueException $e) {
            return false;
        }

        // check number of vertices reachable from root should match total number of vertices
        return ($num === count($this->graph->getVertices()));
    }