我试图刷新一些数据介绍数据库,但我收到了这个错误:
Notice: Array to string conversion in C:\wamp\www\vendor\doctrine\dbal\lib\Doctrine\DBAL\Statement.php line 120
我的代码:
if($request->getMethod() == 'POST') {
if($form->isValid()) {
$c_name = $form->get('c_name')->getData();
$knowas = $form->get('knowas')->getData();
$c_country = $form->get('c_country')->getData();
$c_web = $form->get('c_web')->getData();
$street = $new->getAdresses('street');
$pobox = $new->getAdresses('pobox');
$city = $new->getAdresses('city');
$country = $new->getAdresses('country');
$tel = $new->getAdresses('tel');
$fax = $new->getAdresses('fax');
$p_person = $new->getContacts('p_person');
$p_email = $new->getContacts('p_email');
$position = $new->getContacts('position');
$p_mobile = $new->getContacts('p_mobile');
$p_phone = $new->getContacts('p_phone');
$number = $new->getLicenses('number');
$type = $new->getLicenses('type');
$issuedate = $new->getLicenses('issuedate');
$expiredate = $new->getLicenses('expiredate');
$o_name = $new->getOwners('o_name');
$nationality = $new->getOwners('nationality');
$percent = $new->getOwners('percent');
//--------------
$new->setCName($c_name);
$new->setKnowas($knowas);
$new->setCCountry($c_country);
$new->setCWeb($c_web);
$new_adresses->setStreet($street);
$new_adresses->setPobox($pobox);
$new_adresses->setCity($city);
$new_adresses->setCountry($country);
$new_adresses->setTel($tel);
$new_adresses->setFax($fax);
$new_contacts->setPPerson($p_person);
$new_contacts->setPEmail($p_email);
$new_contacts->setPosition($position);
$new_contacts->setPMobil($p_mobile);
$new_contacts->setPPhone($p_phone);
$new_licenses->setNumber($number);
$new_licenses->setType($type);
$new_licenses->setIssuedate($issuedate);
$new_licenses->setExpiredate($expiredate);
$new_owners->setOName($o_name);
$new_owners->setNationality($nationality);
$new_owners->setPercent($percent);
$em = $this->getDoctrine()->getManager();
$em->persist($new);
$em->persist($new_adresses);
$em->persist($new_contacts);
$em->persist($new_licenses);
$em->persist($new_owners);
$em->flush();
$message .= 'Successfully added!!';
我不知道该怎么做,我试着在谷歌搜索答案,但似乎没有什么比我的问题更好。我认为问题在于flush(),如果我删除它并规则代码一切正常,可能是什么问题,任何想法?