4
미국 주 목록이있는 파일이 있습니다.
알라바마
알래스카
등 심포니 2.0 내가 내 양식에서 사용하는 ChoiceListInterface.php을 사용Symfony 2.1에서 ChoiceList를 사용하는 방법은 무엇입니까?
. 간단히 말해서 나는 당신이 쓴 :
<?php
namespace MyBundle\Form;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
class StateChoiceList implements ChoiceListInterface
{
public function getChoices()
{
$lines = file('listes/us_states.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
// fill the array
$arr = array();
foreach ($lines as $line) {
$arr[$line] = $line;
}
return $arr;
}
}
을하지만 지금 ChoiceListInterface에서 구현하기 (7 개) 다른 기능이있다 : 나는 문서 http://api.symfony.com/2.1/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.html를 읽고 있지만 내 경우에는 '내가 불분명 발견하고 정말 돈
public function getValues();
public function getPreferredViews();
public function getRemainingViews();
public function getValuesForChoices(array $choices);
public function getIndicesForChoices(array $choices);
public function getIndicesForValues(array $values);
은 그것들을 구현하는 방법을 이해해야한다.
누군가가 도움을 얻을 수 있습니까? 고마워요