本文整理汇总了PHP中Cake\Database\Schema\Table::dropConstraintSql方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::dropConstraintSql方法的具体用法?PHP Table::dropConstraintSql怎么用?PHP Table::dropConstraintSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Database\Schema\Table
的用法示例。
在下文中一共展示了Table::dropConstraintSql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dropConstraints
/**
* {@inheritDoc}
*/
public function dropConstraints(ConnectionInterface $db)
{
if (empty($this->_constraints)) {
return true;
}
$sql = $this->_schema->dropConstraintSql($db);
if (empty($sql)) {
return true;
}
foreach ($sql as $stmt) {
$db->execute($stmt)->closeCursor();
}
foreach ($this->_constraints as $name => $data) {
$this->_schema->dropConstraint($name);
}
return true;
}
示例2: testDropConstraintSql
/**
* Test the dropConstraintSql method.
*
* @return void
*/
public function testDropConstraintSql()
{
$driver = $this->_getMockedDriver();
$connection = $this->getMockBuilder('Cake\\Database\\Connection')->disableOriginalConstructor()->getMock();
$connection->expects($this->any())->method('driver')->will($this->returnValue($driver));
$table = new Table('posts');
$result = $table->dropConstraintSql($connection);
$this->assertEmpty($result);
}