本文整理汇总了PHP中Generic::onSetUp方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::onSetUp方法的具体用法?PHP Generic::onSetUp怎么用?PHP Generic::onSetUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generic
的用法示例。
在下文中一共展示了Generic::onSetUp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSetUp
public function onSetUp()
{
// mysql from version 5.5.7 does not like to truncate tables with foreign key references: http://bugs.mysql.com/bug.php?id=58788
$this->getConnection()->getConnection()->exec('SET foreign_key_checks = 0');
parent::onSetUp();
$this->getConnection()->getConnection()->exec('SET foreign_key_checks = 1');
}
示例2: onSetUp
public function onSetUp()
{
parent::onSetUp();
$pdo = $this->getConnection()->getConnection();
// update next serial/autoincrement value to max
foreach ($pdo->query("SELECT table_name, column_name FROM information_schema.columns WHERE column_default LIKE 'nextval%';")->fetchAll(\PDO::FETCH_ASSOC) as $info) {
$query = "SELECT setval((SELECT pg_get_serial_sequence('" . $info['table_name'] . "', '" . $info['column_name'] . "') as sequence), (SELECT max(" . $info['column_name'] . ") FROM " . $info['table_name'] . "));";
$pdo->query($query);
}
}