本文整理匯總了PHP中sfWidgetFormSchema::setPositions方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfWidgetFormSchema::setPositions方法的具體用法?PHP sfWidgetFormSchema::setPositions怎麽用?PHP sfWidgetFormSchema::setPositions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfWidgetFormSchema
的用法示例。
在下文中一共展示了sfWidgetFormSchema::setPositions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sfWidgetFormSchema
// ->setPositions() ->getPositions()
$t->diag('->setPositions() ->getPositions()');
$w = new sfWidgetFormSchema();
$w['w1'] = $w1;
$w['w2'] = $w2;
$w->setPositions(array('w2', 'w1'));
$t->is($w->getPositions(), array('w2', 'w1'), '->setPositions() changes all field positions');
$w->setPositions(array('w1', 'w2'));
$t->is($w->getPositions(), array('w1', 'w2'), '->setPositions() changes all field positions');
$w = new sfWidgetFormSchema();
$w['w1'] = $w1;
$w['w2'] = $w2;
$w['w1'] = $w1;
$t->is($w->getPositions(), array('w1', 'w2'), '->setPositions() changes all field positions');
try {
$w->setPositions(array('w1', 'w2', 'w3'));
$t->fail('->setPositions() throws an InvalidArgumentException if you give it a non existant field name');
} catch (InvalidArgumentException $e) {
$t->pass('->setPositions() throws an InvalidArgumentException if you give it a non existant field name');
}
try {
$w->setPositions(array('w1'));
$t->fail('->setPositions() throws an InvalidArgumentException if you miss a field name');
} catch (InvalidArgumentException $e) {
$t->pass('->setPositions() throws an InvalidArgumentException if you miss a field name');
}
// ->moveField()
$t->diag('->moveField()');
$w = new sfWidgetFormSchema();
$w['w1'] = $w1;
$w['w2'] = $w2;