本文整理匯總了PHP中Symfony\Component\Form\FormView::getIterator方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormView::getIterator方法的具體用法?PHP FormView::getIterator怎麽用?PHP FormView::getIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Form\FormView
的用法示例。
在下文中一共展示了FormView::getIterator方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: extractRules
protected function extractRules(FormRuleContextBuilder $formRuleContext, FormInterface $form, FormView $view)
{
$extracted = new FormRuleContextBuilder();
if ($form->getConfig()->getCompound()) {
$it = new \RecursiveIteratorIterator(new FormViewRecursiveIterator($view->getIterator()), \RecursiveIteratorIterator::SELF_FIRST);
$found = array();
foreach ($it as $childView) {
$found[] = FormHelper::getFormName($childView);
}
} else {
$found = array($view);
}
foreach ($found as $foundView) {
$rules = $formRuleContext->get($foundView);
if ($rules === null) {
continue;
}
$extracted->add($foundView, $rules);
$formRuleContext->remove($foundView);
}
return $extracted;
}
示例2: __construct
/**
* @param \Symfony\Component\Form\FormView $formView
*/
public function __construct(FormView $formView)
{
$this->iterator = $formView->getIterator();
}
示例3: getFormDataFromResult
/**
* @param \Symfony\Component\Form\FormView $formView
*
* @return array
*/
protected function getFormDataFromResult(FormView $formView)
{
$customerData = [];
foreach ($formView->getIterator() as $item) {
$customerData[$item->vars['name']] = $item->vars['value'];
}
return $customerData;
}