本文整理匯總了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);
}