Returns a table with the name and columns prefixed.

@param string $prefix

@return Table
763690
public function withColumnsPrefixedBy(string $prefix) : Table
    {
        $columns = [];
        foreach ($this->columns as $column) {
            $columns[] = $column->withPrefix($prefix);
        }

        $indexes = [];
        foreach ($this->indexes as $index) {
            $indexes[] = $index->withColumnsPrefixedBy($prefix);
        }

        $foreignKeys = [];
        foreach ($this->foreignKeys as $foreignKey) {
            $foreignKeys[] = $foreignKey->withLocalColumnsPrefixedBy($prefix);
        }


        return new self(
            $this->name,
            $columns,
            $indexes,
            $foreignKeys
        );
    }
698213
private function getClassName($table, $prefix)
    {
        $prefixLen = strlen($prefix);
        if(substr($table, 0, $prefixLen) === $prefix)
        {
            $table = substr($table, $prefixLen);
        }
        return Text::toPascalName($table);
    }
331949
protected static function getWithPrefix($table)
    {
        $prefix = static::$prefix;

        if (is_null($prefix) || empty($prefix)) {
            // If prefix is null, then no need to prepend a redundant _
            return $table;
        }

        return sprintf('%s_%s', $prefix, $table);
    }
81861
public function find($prefix = 'u')
    {
        $selectFromDQL = $this->getSelectFrom($prefix);
        $whereDQL = $this->getWhere($prefix);
        if (true != $this->countQuery) {
            $orderDQL = $this->getOrderBy($prefix);
        } else {
            $orderDQL = '';
        }
        $dql = sprintf('%s %s %s', $selectFromDQL, $whereDQL, $orderDQL);

        return $dql;
    }
1005646
public function getQueryFields($usePrefix = false, $prefix = '')
    {
        $fields = $this->fields;

        if ($usePrefix) {
            $prefix = (empty($prefix) ? $this->getTable() : $prefix);
            $fields = array();
            foreach ($this->fields as $field) {
                $fields[] = $prefix . '.' . $field;
            }
        }

        return implode(', ', $fields);
    }
1156789
private function getName($prefixed = true)
    {
        return $this->clean(
            $prefixed ? $this->prefix.$this->name : $this->name
        );
    }
1238341
function getNamespaceFromPrefix($prefix)
    {
        if (isset($this->namespaces[$prefix])) {
            return $this->namespaces[$prefix];
        }

        //$this->setError("No namespace registered for prefix '$prefix'");
        return FALSE;
    }
955777
protected function getConstNameToIds($prefix)
    {
        if (!isset(self::$constNameToIds[$prefix])) {
            foreach ($this->getConsts($prefix) as $const) {
                self::$constNameToIds[$prefix][$const['name']] = $const['id'];
            }
        }

        return self::$constNameToIds[$prefix];
    }
1204353
public function prefix($prefix = null)
    {
        if (null !== $prefix) {
            $this->prefix = substr(md5($prefix), 0, 10) . '_';
        }

        return $this->prefix;
    }
1359456
public function withColumnsPrefixedBy(string $prefix): FinalizedMapperDefinition
    {
        if ($prefix === '') {
            return $this;
        }

        $table       = $this->table->withColumnsPrefixedBy($prefix);
        $entityTable = $this->entityTable->withColumnsPrefixedBy($prefix);

        $propertyColumnNameMap = [];
        foreach ($this->propertyColumnNameMap as $property => $column) {
            $propertyColumnNameMap[$property] = $prefix . $column;
        }

        $columnGetterMap = [];
        foreach ($this->columnGetterMap as $column => $getter) {
            $columnGetterMap[$prefix . $column] = $getter;
        }

        $columnSetterMap = [];
        foreach ($this->columnSetterMap as $column => $setter) {
            $columnSetterMap[$prefix . $column] = $setter;
        }

        $methodColumnNameMap = [];
        foreach ($this->methodColumnNameMap as $property => $column) {
            $methodColumnNameMap[$property] = $prefix . $column;
        }

        $lockingStrategies = [];
        foreach ($this->lockingStrategies as $key => $lockingStrategy) {
            $lockingStrategies[$key] = $lockingStrategy->withColumnNamesPrefixedBy($prefix);
        }

        $persistHooks = [];
        foreach ($this->persistHooks as $key => $persistHook) {
            $persistHooks[$key] = $persistHook->withColumnNamesPrefixedBy($prefix);
        }

        if ($this->hasInitializedRelations) {
            $relationMappingsFactory = function () {
                return $this->getRelationMappings();
            };

            $foreignKeyFactory = function () {
                return [];
            };
        } else {
            $relationMappingsFactory = $this->relationMappingsFactory;
            $foreignKeyFactory       = $this->foreignKeysFactory;
        }

        $relationMappingsFactory = function (Table $parentTable, IObjectMapper $parentMapper) use ($relationMappingsFactory, $prefix) {
            $mappings = [];

            /** @var RelationMapping $mapping */
            foreach ($relationMappingsFactory($parentTable, $parentMapper) as $mapping) {
                $mappings[] = $mapping->withEmbeddedColumnsPrefixedBy($prefix);
            }

            return $mappings;
        };

        $foreignKeyFactory = function (Table $parentTable) use ($foreignKeyFactory, $prefix) {
            $foreignKeys = [];
            /** @var ForeignKey $foreignKey */
            foreach ($foreignKeyFactory($parentTable) as $foreignKey) {
                $foreignKeys[] = $foreignKey->withLocalColumnsPrefixedBy($prefix);
            }

            return $foreignKeys;
        };

        $subClassMappings = [];
        foreach ($this->subClassMappings as $mapping) {
            $subClassMappings[] = $mapping->withEmbeddedColumnsPrefixedBy($prefix);
        }

        $self = new self(
            $this->orm,
            $this->class,
            $table,
            $propertyColumnNameMap,
            $columnGetterMap,
            $columnSetterMap,
            $this->phpToDbPropertyConverterMap,
            $this->dbToPhpPropertyConverterMap,
            $methodColumnNameMap,
            $this->customLoadMappingCallbacks,
            $lockingStrategies,
            $persistHooks,
            $subClassMappings,
            $relationMappingsFactory,
            $foreignKeyFactory,
            $entityTable
        );

        if ($this->hasInitializedRelations) {
            $self->initializeRelations(new NullObjectMapper());
        }

        return $self;
    }
258144
public function list(string $prefix): ListCommand
    {
        /** @var ListCommand $command */
        $command = $this->builder->build(ListCommand::class);
        $command->byPrefix($prefix);

        return $command;
    }
1064098
public function getTable($withPrefix = true)
    {
        if (is_null($this->table)) {
            $classBasename = (new \ReflectionClass($this))->getShortName();
            $this->setTable(strtolower($classBasename));
        }

        if ($withPrefix) {
            return $this->getPrefix() . $this->table;
        }

        return $this->table;
    }
811921
public function setTablePrefix($prefix)
    {
        $this->tablePrefix = $prefix;

        $this->getQueryGrammar()->setTablePrefix($prefix);

        return $this;
    }
116769
function ___table($tableName) {
        $this->name = $tableName;
        $this->table = $this->prefix.$tableName;
        return $this;
    }
913317
public function getTable()
	{
		$schema_prefix = '';
		$schema = $this->getSchema();
		if (isset($schema) && $schema != '') $schema_prefix = $schema . '.';
		
		if (isset($this->table)) 	$table = $this->table;
		else 						$table = str_replace('\\', '', snake_case(class_basename($this)));
		
		if (stripos($table, '.') !== false)
			return $table;
		else
			return $schema_prefix . $table;
	}
978138
public function getTables($prefixLimit = false)
    {
        if (empty($this->queriesResultCache[ 'tableNames' ])) {

            $sqlStatement = 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\'';

            if ($prefixLimit !== false && $this->config[ 'tablePrefix' ] !== '') {
                $sqlStatement .= ' AND "NAME" LIKE \'' . $this->escapeLikeString($this->config[ 'tablePrefix' ]) . "%' ";
            }

            $result = $this->query($sqlStatement);

            if ($result->count()) {
                foreach ($result as $row) {
                    // Do we know from which column to get the table name?
                    if ( ! isset($key)) {
                        if (isset($row[ 'table_name' ])) {
                            $key = 'table_name';
                        } elseif (isset($row[ 'TABLE_NAME' ])) {
                            $key = 'TABLE_NAME';
                        } else {
                            /* We have no other choice but to just get the first element's key.
                             * Due to array_shift() accepting its argument by reference, if
                             * E_STRICT is on, this would trigger a warning. So we'll have to
                             * assign it first.
                             */
                            $key = array_keys($row->getArrayCopy());
                            $key = array_shift($key);
                        }
                    }

                    $this->queriesResultCache[ 'tableNames' ][] = $row->offsetGet($key);
                }
            }
        }

        return $this->queriesResultCache[ 'tableNames' ];
    }
896126
public function prefix($prefix)
    {
        $this->uri = trim($prefix, '/') .'/' .trim($this->uri, '/');

        return $this;
    }