public function validateTableName($attribute, $params)
    {
        if ($this->hasErrors()) {
            return;
        }

        $invalidTables = array();
        $invalidColumns = array();

        if ($this->tableName[strlen($this->tableName) - 1] === '*') {
            if (($pos = strrpos($this->tableName, '.')) !== false) {
                $schema = substr($this->tableName, 0, $pos);
            } else {
                $schema = '';
            }

            $tables = $this->getDbConnection()->schema->getTables($schema);
            foreach ($tables as $table) {
                if ($this->tablePrefix == '' || strpos($table->name, $this->tablePrefix) === 0) {
                    if ($this->isReservedKeyword($table->name)) {
                        $invalidTables[] = $table->name;
                    }
                    if (($invalidColumn = $this->checkColumns($table)) !== null) {
                        $invalidColumns[] = $invalidColumn;
                    }
                }
            }
        } else {
            if (($table = $this->getTableSchema($this->tableName)) === null) {
                $this->addError('tableName', "Table '{$this->tableName}' does not exist.");
            }

            if (!$this->hasErrors($attribute) && ($invalidColumn = $this->checkColumns($table)) !== null) {
                $invalidColumns[] = $invalidColumn;
            }
        }

        if ($invalidTables != array()) {
            $this->addError(
                'tableName',
                'Model class cannot take a reserved PHP keyword! Table name: ' . implode(', ', $invalidTables) . "."
            );
        }
        if ($invalidColumns != array()) {
            $this->addError(
                'tableName',
                'Column names that does not follow PHP variable naming convention: ' . implode(
                    ', ',
                    $invalidColumns
                ) . "."
            );
        }
    }