사용자에게 고유 한 드롭 다운을 만들고 그걸 할 수있는 방법을 찾았지만 클라이언트에서는 좋지 않습니다. 이 일Zf2 양식 userId에 따라 달라집니다
public function __construct($name = null, EntityManager $em = null, $userId = null)
{
parent::__construct($name);
$this->setAttribute('method', 'post');
[...]
$this->add(array(
'name' => 'religionId',
'type' => 'DoctrineModule\Form\Element\ObjectSelect',
'options' => array(
'object_manager' => $this->getEntityManager(),
'target_class' => 'Religions\Entity\Religions',
'property' => 'name',
'disable_inarray_validator' => true,
'by_reference' => false,
'is_method' => true,
'find_method' => array(
'name' => 'findBy',
'params' => array(
'criteria' => array('reUserId' => $userId),
'orderBy' => array('name' => 'ASC'),
),
),
),
'attributes' => array(
'multiple' => false,
'required' => false,
)
));
}
, 양식을 초기화 할 때 i는 사용자 개체를 삽입하고 선택하기 위해 클라이언트가 원하는 $this->identity()
를 사용하여 변수 reuserId를 전송되면서 여기
는 i`ve이 무슨 짓입니다 거기에서 ....검색된 stackoverflow 및 google,하지만 아무것도 찾을 수 없습니다 ... 어떤 도움주세요? 감사!
위대한 답변! 감사! –