当前位置: 首页>>代码示例>>PHP>>正文


PHP ForeignKeyConstraint::getName方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Schema\ForeignKeyConstraint::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP ForeignKeyConstraint::getName方法的具体用法?PHP ForeignKeyConstraint::getName怎么用?PHP ForeignKeyConstraint::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Schema\ForeignKeyConstraint的用法示例。


在下文中一共展示了ForeignKeyConstraint::getName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: acceptForeignKey

 /**
  * {@inheritdoc}
  */
 public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
 {
     // The table may already be deleted in a previous
     // RemoveNamespacedAssets#acceptTable call. Removing Foreign keys that
     // point to nowhere.
     if (!$this->schema->hasTable($fkConstraint->getForeignTableName())) {
         $localTable->removeForeignKey($fkConstraint->getName());
         return;
     }
     $foreignTable = $this->schema->getTable($fkConstraint->getForeignTableName());
     if (!$foreignTable->isInDefaultNamespace($this->schema->getName())) {
         $localTable->removeForeignKey($fkConstraint->getName());
     }
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:17,代码来源:RemoveNamespacedAssets.php

示例2: acceptForeignKey

 /**
  * @param Table $localTable
  * @param ForeignKeyConstraint $fkConstraint
  */
 public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
 {
     if (strlen($fkConstraint->getName()) == 0) {
         throw SchemaException::namedForeignKeyRequired($localTable, $fkConstraint);
     }
     $this->_constraints[] = $this->_platform->getDropForeignKeySQL($fkConstraint->getQuotedName($this->_platform), $localTable->getQuotedName($this->_platform));
 }
开发者ID:MarS2806,项目名称:Zend-Framework--Doctrine-ORM--PHPUnit--Ant--Jenkins-CI--TDD-,代码行数:11,代码来源:DropSchemaSqlCollector.php

示例3: acceptForeignKey

 /**
  * {@inheritdoc}
  */
 public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
 {
     if (strlen($fkConstraint->getName()) == 0) {
         throw SchemaException::namedForeignKeyRequired($localTable, $fkConstraint);
     }
     $this->constraints->attach($fkConstraint, $localTable);
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:10,代码来源:DropSchemaSqlCollector.php

示例4: getForeignKeyBaseDeclarationSQL

 /**
  * {@inheritdoc}
  */
 public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey)
 {
     $sql = '';
     $foreignKeyName = $foreignKey->getName();
     $localColumns = $foreignKey->getQuotedLocalColumns($this);
     $foreignColumns = $foreignKey->getQuotedForeignColumns($this);
     $foreignTableName = $foreignKey->getQuotedForeignTableName($this);
     if (!empty($foreignKeyName)) {
         $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
     }
     if (empty($localColumns)) {
         throw new \InvalidArgumentException("Incomplete definition. 'local' required.");
     }
     if (empty($foreignColumns)) {
         throw new \InvalidArgumentException("Incomplete definition. 'foreign' required.");
     }
     if (empty($foreignTableName)) {
         throw new \InvalidArgumentException("Incomplete definition. 'foreignTable' required.");
     }
     if ($foreignKey->hasOption('notnull') && (bool) $foreignKey->getOption('notnull')) {
         $sql .= 'NOT NULL ';
     }
     return $sql . 'FOREIGN KEY (' . $this->getIndexFieldDeclarationListSQL($localColumns) . ') ' . 'REFERENCES ' . $foreignKey->getQuotedForeignTableName($this) . ' (' . $this->getIndexFieldDeclarationListSQL($foreignColumns) . ')';
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:27,代码来源:SQLAnywherePlatform.php

示例5: _addForeignKeyConstraint

 /**
  * @param ForeignKeyConstraint $constraint
  */
 protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint)
 {
     $constraint->setLocalTable($this);
     if (strlen($constraint->getName())) {
         $name = $constraint->getName();
     } else {
         $name = $this->_generateIdentifierName(array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->_getMaxIdentifierLength());
     }
     $name = strtolower($name);
     $this->_fkConstraints[$name] = $constraint;
     // add an explicit index on the foreign key columns. If there is already an index that fullfils this requirements drop the request.
     // In the case of __construct calling this method during hydration from schema-details all the explicitly added indexes
     // lead to duplicates. This creates compuation overhead in this case, however no duplicate indexes are ever added (based on columns).
     $this->addIndex($constraint->getColumns());
 }
开发者ID:michaelnavarro,项目名称:zc,代码行数:18,代码来源:Table.php

示例6: getForeignKeyBaseDeclarationSQL

 /**
  * Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
  * of a field declaration to be used in statements like CREATE TABLE.
  *
  * @param ForeignKeyConstraint $foreignKey
  * @return string
  */
 public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey)
 {
     $sql = '';
     if (strlen($foreignKey->getName())) {
         $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
     }
     $sql .= 'FOREIGN KEY (';
     if (count($foreignKey->getLocalColumns()) == 0) {
         throw new \InvalidArgumentException("Incomplete definition. 'local' required.");
     }
     if (count($foreignKey->getForeignColumns()) == 0) {
         throw new \InvalidArgumentException("Incomplete definition. 'foreign' required.");
     }
     if (strlen($foreignKey->getForeignTableName()) == 0) {
         throw new \InvalidArgumentException("Incomplete definition. 'foreignTable' required.");
     }
     $sql .= implode(', ', $foreignKey->getLocalColumns()) . ') REFERENCES ' . $foreignKey->getForeignTableName() . ' (' . implode(', ', $foreignKey->getForeignColumns()) . ')';
     return $sql;
 }
开发者ID:pollux1er,项目名称:dlawebdev2,代码行数:26,代码来源:AbstractPlatform.php

示例7: getForeignKeyDeclarationSQL

 /**
  * {@inheritDoc}
  */
 public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey)
 {
     return parent::getForeignKeyDeclarationSQL(new ForeignKeyConstraint($foreignKey->getQuotedLocalColumns($this), str_replace('.', '__', $foreignKey->getQuotedForeignTableName($this)), $foreignKey->getQuotedForeignColumns($this), $foreignKey->getName(), $foreignKey->getOptions()));
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:7,代码来源:SqlitePlatform.php

示例8: checkForeignKeyConstraint

 /**
  * Do checks for foreignKey constraints.
  *
  * @param ForeignKeyConstraint $foreignKeyConstraint
  * @param IgnoredChange        $ignoredChange
  *
  * @return boolean
  */
 protected function checkForeignKeyConstraint(ForeignKeyConstraint $foreignKeyConstraint, IgnoredChange $ignoredChange)
 {
     // Not needed to be implemented yet
     if ($ignoredChange->getPropertyName() !== $foreignKeyConstraint->getName()) {
         return false;
     }
     return false;
 }
开发者ID:zomars,项目名称:bolt,代码行数:16,代码来源:DiffUpdater.php

示例9: _addForeignKeyConstraint

 /**
  * @param ForeignKeyConstraint $constraint
  */
 protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint)
 {
     $constraint->setLocalTable($this);
     if (strlen($constraint->getName())) {
         $name = $constraint->getName();
     } else {
         $name = $this->_generateIdentifierName(array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->_getMaxIdentifierLength());
     }
     $name = strtolower($name);
     $this->_fkConstraints[$name] = $constraint;
 }
开发者ID:andreia,项目名称:doctrine,代码行数:14,代码来源:Table.php

示例10: checkForeignKeyConstraint

 /**
  * Do checks for foreignKey constraints.
  *
  * @param ForeignKeyConstraint $foreignKeyConstraint
  * @param array                $alterData
  *
  * @return boolean
  */
 protected function checkForeignKeyConstraint(ForeignKeyConstraint $foreignKeyConstraint, array $alterData)
 {
     // Not needed to be implemented yet
     if ($alterData['propertyName'] !== $foreignKeyConstraint->getName()) {
         return false;
     }
     return false;
 }
开发者ID:somekoala,项目名称:bolt,代码行数:16,代码来源:DiffUpdater.php

示例11: _addForeignKeyConstraint

 /**
  * @param ForeignKeyConstraint $constraint
  *
  * @return void
  */
 protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint)
 {
     $constraint->setLocalTable($this);
     if (strlen($constraint->getName())) {
         $name = $constraint->getName();
     } else {
         $name = $this->_generateIdentifierName(array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->_getMaxIdentifierLength());
     }
     $name = $this->normalizeIdentifier($name);
     $this->_fkConstraints[$name] = $constraint;
     // add an explicit index on the foreign key columns. If there is already an index that fulfils this requirements drop the request.
     // In the case of __construct calling this method during hydration from schema-details all the explicitly added indexes
     // lead to duplicates. This creates computation overhead in this case, however no duplicate indexes are ever added (based on columns).
     $indexName = $this->_generateIdentifierName(array_merge(array($this->getName()), $constraint->getColumns()), "idx", $this->_getMaxIdentifierLength());
     $indexCandidate = $this->_createIndex($constraint->getColumns(), $indexName, false, false);
     foreach ($this->_indexes as $existingIndex) {
         if ($indexCandidate->isFullfilledBy($existingIndex)) {
             return;
         }
     }
     $this->_addIndex($indexCandidate);
     $this->implicitIndexes[$this->normalizeIdentifier($indexName)] = $indexCandidate;
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:28,代码来源:Table.php

示例12: createForeignKeyReplacement

 /**
  * Creates a foreign index replacement, which has quoted column names.
  *
  * @param ForeignKeyConstraint $fk
  *
  * @return ForeignKeyConstraint
  */
 private function createForeignKeyReplacement(ForeignKeyConstraint $fk)
 {
     return new ForeignKeyConstraint($this->quoteIdentifiers($fk->getLocalColumns()), $this->platform->quoteIdentifier($fk->getForeignTableName()), $this->quoteIdentifiers($fk->getForeignColumns()), $this->platform->quoteIdentifier($fk->getName()), $fk->getOptions());
 }
开发者ID:digilist,项目名称:snakedumper,代码行数:11,代码来源:IdentifierQuoter.php

示例13: acceptForeignKey

 /**
  * Accept a foreign key for a table
  *
  * @param Table                $localTable   a table object
  * @param ForeignKeyConstraint $fkConstraint a constraint object
  * 
  * @return void
  */
 public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
 {
     if (!isset($this->schemaArray['tables'][$localTable->getName()]['constraint'])) {
         $this->schemaArray['tables'][$localTable->getName()]['constraint'] = array();
     }
     $this->schemaArray['tables'][$localTable->getName()]['constraint'][] = array('name' => $fkConstraint->getName(), 'localcolumns' => $fkConstraint->getLocalColumns(), 'foreigntable' => $fkConstraint->getForeignTableName(), 'foreigncolumns' => $fkConstraint->getForeignColumns(), 'options' => $fkConstraint->getOptions());
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:15,代码来源:ExportVisitor.php


注:本文中的Doctrine\DBAL\Schema\ForeignKeyConstraint::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。