0
我在symfony或doctrine中遇到問題。 我有一個實體notificationsettinggroupdetail
和notificationsettinggroup
。學說(Symfony3)可捕捉的致命錯誤:傳遞給(bundle)的參數1必須是(bundle)的一個實例,數組給出
Notificationsettinggroup
and notificationsettinggroup
是主要細節,並在實體原則中具有連接條件。
的問題都交給我時,我想用刪除從主(notificationsetinggroup
)數據細節:
/**
* Remove notificationSettingGroupDetail
*
* @param \Dsp\DspAdministrationBundle\Entity\notificationSettingGroupDetail $notificationSettingGroupDetail
*/
public function removeNotificationSettingGroupDetail(notificationSettingGroupDetail $notificationSettingGroupDetail)
{
$this->NotificationSettingGroupDetail->removeElement($notificationSettingGroupDetail);
}
,但是當我用這個,我得到了一些錯誤:
Catchable Fatal Error: Argument 1 passed to Dsp\DspAdministrationBundle\Entity\notificationSettingGroup::removeNotificationSettingGroupDetail() must be an instance of Dsp\DspAdministrationBundle\Entity\notificationSettingGroupDetail, array given, called in C:\xampp\htdocs\Symfony-DspWebApp\src\Dsp\DspAdministrationBundle\Controller\Api\ApiNotificationSettingGroupController.php on line 122 and defined
這是代碼在控制器中:
$entityDetailDelete = $this->getDoctrine()->getRepository(notificationSettingGroupDetail::class)->findNotificationGroupSettingDetailByMaster($userOld[$i]['id']);
$entity->removeNotificationSettingGroupDetail($entityDetailDelete);
哪裏是我的錯?