本文整理汇总了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;