本文整理汇总了PHP中Doctrine\DBAL\Platforms\AbstractPlatform::getCreateConstraintSQL方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPlatform::getCreateConstraintSQL方法的具体用法?PHP AbstractPlatform::getCreateConstraintSQL怎么用?PHP AbstractPlatform::getCreateConstraintSQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Platforms\AbstractPlatform
的用法示例。
在下文中一共展示了AbstractPlatform::getCreateConstraintSQL方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dumpConstraints
/**
* Dump the constraints / foreign keys of all tables.
*
* The constraints should be created at the end to speed up the import of the dump.
*
* @param Table[] $tables
*/
public function dumpConstraints(array $tables)
{
foreach ($tables as $table) {
foreach ($table->getForeignKeys() as $constraint) {
$constraint = $this->platform->getCreateConstraintSQL($constraint, $table);
$this->dumpOutput->writeln($constraint . ';');
}
}
}
示例2: testGeneratesConstraintCreationSql
public function testGeneratesConstraintCreationSql()
{
$idx = new \Doctrine\DBAL\Schema\Index('constraint_name', array('test'), true, false);
$sql = $this->_platform->getCreateConstraintSQL($idx, 'test');
$this->assertEquals($this->getGenerateConstraintUniqueIndexSql(), $sql);
$pk = new \Doctrine\DBAL\Schema\Index('constraint_name', array('test'), true, true);
$sql = $this->_platform->getCreateConstraintSQL($pk, 'test');
$this->assertEquals($this->getGenerateConstraintPrimaryIndexSql(), $sql);
$fk = new \Doctrine\DBAL\Schema\ForeignKeyConstraint(array('fk_name'), 'foreign', array('id'), 'constraint_fk');
$sql = $this->_platform->getCreateConstraintSQL($fk, 'test');
$this->assertEquals($this->getGenerateConstraintForeignKeySql($fk), $sql);
}
示例3: createConstraint
/**
* Create a constraint on a table
*
* @param Constraint $constraint
* @param string|Table $table
*/
public function createConstraint(Constraint $constraint, $table)
{
$this->_execSql($this->_platform->getCreateConstraintSQL($constraint, $table));
}
示例4: getCreateConstraintSQL
/**
* {@inheritDoc}
*/
public function getCreateConstraintSQL(Constraint $constraint, $table)
{
$constraintSql = parent::getCreateConstraintSQL($constraint, $table);
return $this->repositionContraintNameSQL($constraint, $constraintSql);
}