symfony2.1 でフォームを送信しようとしましたが、次のエラーが発生しました。学生登録フォームを作成して送信しようとしました。これについてフォーラムを確認しましたが、適切な解決策がありません。
Error:Catchable Fatal Error: Argument 1 passed to
Frontend\EntityBundle\Entity\StudentRegistration::setIdCountry()
must be an instance of Frontend\EntityBundle\Entity\MasterCountry, string given,
called in C:\wamp\www\careerguide\src\Frontend\HomeBundle\Controller\RegistrationController.php
on line 41 and defined in C:\wamp\www\careerguide\src\Frontend\EntityBundle\Entity\StudentRegistration.php line 1253
コントローラーには次のものがあります:
$student_account = new \Frontend\EntityBundle\Entity\StudentRegistration();
$params = $request->get('student_registration');
$student_account->setIdCountry($params['idCountry']);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($student_account);
$em->flush();
エンティティ クラス:
/**
* @var MasterCountry
*
* @ORM\ManyToOne(targetEntity="MasterCountry")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="id_country", referencedColumnName="id_country")
* })
*/
private $idCountry;
このエラーを解決するために私が何をすべきか教えてください。