本文整理汇总了PHP中Doctrine\DBAL\Schema\Table::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::getName方法的具体用法?PHP Table::getName怎么用?PHP Table::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Table
的用法示例。
在下文中一共展示了Table::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isTableNotIgnored
/**
* @param Table $table
* @return bool
*/
public function isTableNotIgnored(Table $table)
{
if (!$this->config->hasTableConfig($table->getName())) {
return true;
}
return !$this->config->getTableConfig($table->getName())->isTableIgnored();
}
示例2: buildTable
/**
* Get the table's schema object.
*
* @param Schema $schema
* @param string $tableName
*
* @return \Doctrine\DBAL\Schema\Table
*/
public function buildTable(Schema $schema, $tableName)
{
$this->table = $schema->createTable($tableName);
$this->tableName = $this->table->getName();
$this->addColumns();
$this->addIndexes();
$this->setPrimaryKey();
return $this->table;
}
示例3: buildTable
/**
* Get the table's schema object.
*
* @param Schema $schema
* @param string $tableName
* @param string $aliasName
* @param string $charset
* @param string $collate
*
* @return \Doctrine\DBAL\Schema\Table
*/
public function buildTable(Schema $schema, $tableName, $aliasName, $charset, $collate)
{
$this->table = $schema->createTable($tableName);
$this->table->addOption('alias', $aliasName);
$this->table->addOption('charset', $charset);
$this->table->addOption('collate', $collate);
$this->aliasName = $aliasName;
$this->tableName = $this->table->getName();
$this->addColumns();
$this->addIndexes();
$this->setPrimaryKey();
return $this->table;
}
示例4: acceptForeignKey
/**
* @param Table $localTable
* @param ForeignKeyConstraint $fkConstraint
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
// Append the foreign key constraints SQL
if ($this->_platform->supportsForeignKeyConstraints()) {
$this->_createFkConstraintQueries = array_merge($this->_createFkConstraintQueries, (array) $this->_platform->getCreateForeignKeySQL($fkConstraint, $localTable->getName()));
}
}
示例5: _addTable
/**
* @param Table $table
*/
protected function _addTable(Table $table)
{
$tableName = strtolower($table->getName());
if (isset($this->_tables[$tableName])) {
throw SchemaException::tableAlreadyExists($tableName);
}
$this->_tables[$tableName] = $table;
$table->setSchemaConfig($this->_schemaConfig);
}
示例6: addForeignKey
/**
* @param DBALTable $KeyTarget Foreign Key (Column: KeySource Name)
* @param DBALTable $KeySource Foreign Data (Column: Id)
*/
public function addForeignKey(DBALTable &$KeyTarget, DBALTable $KeySource)
{
if (!$this->Database->hasColumn($KeyTarget->getName(), $KeySource->getName())) {
$KeyTarget->addColumn($KeySource->getName(), 'bigint');
if ($this->Database->getPlatform()->supportsForeignKeyConstraints()) {
$KeyTarget->addForeignKeyConstraint($KeySource, array($KeySource->getName()), array('Id'));
}
}
}
示例7: renameColumn
/**
* Renames a column
*
* @param Schema $schema
* @param QueryBag $queries
* @param Table $table
* @param string $oldColumnName
* @param string $newColumnName
*/
public function renameColumn(Schema $schema, QueryBag $queries, Table $table, $oldColumnName, $newColumnName)
{
$column = new Column(['column' => $table->getColumn($oldColumnName)]);
$column->changeName($newColumnName);
$diff = new TableDiff($table->getName());
$diff->renamedColumns = [$oldColumnName => $column];
$renameQuery = new SqlMigrationQuery($this->platform->getAlterTableSQL($diff));
$queries->addQuery($renameQuery);
}
示例8: __construct
public function __construct(SchemaInformation $schema, \Doctrine\DBAL\Schema\Table $table)
{
$this->table = $table;
$this->schema = $schema;
$this->name = $table->getName();
foreach ($this->table->getColumns() as $column) {
$this->columns[$column->getName()] = new ColumnInformation($this, $table, $column);
}
}
示例9: describe
public function describe($namespace) : array
{
if (substr($namespace, -1) != "\\") {
$namespace .= "\\";
}
$tableIdentifier = $this->dbalSchemaTable->getName();
$methods = ['fetchAll' => $this->describeQueryMethod([], $this->describeQuerySelect('*', $tableIdentifier, []))];
foreach ($this->dbalSchemaTable->getForeignKeys() as $foreignKeyIdentifier => $foreignKey) {
$words = explode('_', $foreignKeyIdentifier);
$camelCased = array_map('ucfirst', $words);
$foreignKeyMethodIdentifier = join('', $camelCased);
$where = array_map(function ($methodParameter) {
return $methodParameter . ' = :' . $methodParameter;
}, $foreignKey->getLocalColumns());
$query = $this->describeQuerySelect('*', $tableIdentifier, $where);
$methods["fetchBy" . $foreignKeyMethodIdentifier] = $this->describeQueryMethod($foreignKey->getLocalColumns(), $query);
}
return ['identifier' => $namespace . $this->dbalSchemaTable->getName(), 'properties' => ['columns' => array_keys($this->dbalSchemaTable->getColumns())], 'methods' => $methods];
}
示例10: checkForForeignKeySourceTable
public function checkForForeignKeySourceTable($columnName)
{
// @var Doctrine\DBAL\Schema\ForeignKeyConstraint[]
$fks = $this->schema->listTableForeignKeys($this->table->getName());
foreach ($fks as $f) {
if (in_array($columnName, $f->getColumns())) {
return $f->getForeignTableName();
}
}
return '';
}
示例11: acceptTable
/**
* @param Table $table
*/
public function acceptTable(Table $table)
{
if (in_array($table->getName(), $this->excludedTables)) {
return;
}
$table->addColumn($this->tenantColumnName, $this->tenantColumnType, array('default' => "federation_filtering_value('" . $this->distributionName . "')"));
$clusteredIndex = $this->getClusteredIndex($table);
$indexColumns = $clusteredIndex->getColumns();
$indexColumns[] = $this->tenantColumnName;
if ($clusteredIndex->isPrimary()) {
$table->dropPrimaryKey();
$table->setPrimaryKey($indexColumns);
} else {
$table->dropIndex($clusteredIndex->getName());
$table->addIndex($indexColumns, $clusteredIndex->getName());
$table->getIndex($clusteredIndex->getName())->addFlag('clustered');
}
}
示例12: addTable
/**
* Add a table object to the schema
*
* @param Table $table table object to add
*
* @return void
*/
public function addTable(Table $table)
{
//echo '<h2>addTable()</h2>';
try {
$name = $table->getName();
$len = strlen($this->xPrefix);
if (substr_compare($name, $this->xPrefix, 0, $len) === 0) {
$name = substr($name, $len);
if (empty($this->tableList) || in_array($name, $this->tableList)) {
$idGeneratorType = 0;
// how should we handle this?
$newtable = new Table($name, $table->getColumns(), $table->getIndexes(), $table->getForeignKeys(), $idGeneratorType, $table->getOptions());
$this->_addTable($newtable);
}
}
//Debug::dump($table);
} catch (\Exception $e) {
\Xoops::getInstance()->events()->triggerEvent('core.exception', $e);
throw $e;
}
}
示例13: saveTable
/**
* @param \Doctrine\DBAL\Schema\Table $table
* @param \SimpleXMLElement $xml
*/
private static function saveTable($table, $xml)
{
$xml->addChild('name', $table->getName());
$declaration = $xml->addChild('declaration');
foreach ($table->getColumns() as $column) {
self::saveColumn($column, $declaration->addChild('field'));
}
foreach ($table->getIndexes() as $index) {
if ($index->getName() == 'PRIMARY') {
$autoincrement = false;
foreach ($index->getColumns() as $column) {
if ($table->getColumn($column)->getAutoincrement()) {
$autoincrement = true;
}
}
if ($autoincrement) {
continue;
}
}
self::saveIndex($index, $declaration->addChild('index'));
}
}
示例14: _generateModel
/**
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return bool|int
* @todo convert to Blade stub
*/
protected function _generateModel(Table $table)
{
$_props = [];
$_name = $table->getName();
$_modelName = $this->_getModelName($_name);
try {
foreach ($table->getColumns() as $_column) {
$_type = $_column->getType()->getName();
$_type == 'datetime' && ($_type = 'Carbon');
$_props[] = ' * @property ' . $_type . ' $' . $_column->getName();
}
$_payload = ['tableName' => $_name, 'modelName' => $_modelName, 'namespace' => $this->option('namespace') ?: 'App\\Models', 'props' => $_props];
$_filename = $this->destination . DIRECTORY_SEPARATOR . $_modelName . '.php';
$_props = implode(PHP_EOL, $_props);
$_php = <<<TEXT
<?php namespace {$_payload['namespace']};
use Carbon\\Carbon;
use Illuminate\\Database\\Eloquent\\Model;
/**
{$_props}
*/
class {$_payload['modelName']} extends Model
{
//******************************************************************************
//* Members
//******************************************************************************
protected \$table = '{$_payload['tableName']}';
}
TEXT;
return file_put_contents($_filename, $_php);
} catch (\Exception $_ex) {
$this->_writeln(' * error examining table "' . $_name . '": ' . $_ex->getMessage());
return false;
}
}
示例15: createTableLabel
/**
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return string
*/
private function createTableLabel(Table $table)
{
// Start the table
$label = '<<TABLE CELLSPACING="0" BORDER="1" ALIGN="LEFT">';
// The title
$label .= '<TR><TD BORDER="1" COLSPAN="3" ALIGN="CENTER" BGCOLOR="#fcaf3e"><FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="12">' . $table->getName() . '</FONT></TD></TR>';
// The attributes block
foreach ($table->getColumns() as $column) {
$columnLabel = $column->getName();
$label .= '<TR>';
$label .= '<TD BORDER="0" ALIGN="LEFT" BGCOLOR="#eeeeec">';
$label .= '<FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="12">' . $columnLabel . '</FONT>';
$label .= '</TD><TD BORDER="0" ALIGN="LEFT" BGCOLOR="#eeeeec"><FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="10">' . strtolower($column->getType()) . '</FONT></TD>';
$label .= '<TD BORDER="0" ALIGN="RIGHT" BGCOLOR="#eeeeec" PORT="col' . $column->getName() . '">';
if ($table->hasPrimaryKey() && in_array($column->getName(), $table->getPrimaryKey()->getColumns())) {
$label .= "✷";
}
$label .= '</TD></TR>';
}
// End the table
$label .= '</TABLE>>';
return $label;
}