简体   繁体   中英

Symfony1 Array to string conversion

i'm working on symfony1 project and i get this exception. anybody have an idea on what is causing it ?

Notice: Array to string conversion in C:\\wamp\\www\\gazette\\apps\\GAZ\\modules\\jobAppliance\\actions\\actions.class.php on line 1183

public function executeSaveCandidateJsni()
{
$jobId = $this->getRequestParameter('job_id');
$job = JobPeer::retrieveByPK($jobId);

// Sauvegarde des objets jobAppliance et de jobApplianceAttachedFile
$listJApplianceAttachedCV = $this->getUser()->getAttribute('list_job_appliance_attached_cv');

// ***this is line 1183*** 

sfContext::getInstance()->getLogger()->debug('(Jsni) $listJApplianceAttachedCV = ' .$listJApplianceAttachedCV); // ***this is line 1183*** 

$listJApplianceAttachedFile = $this->getUser()->getAttribute('list_job_appliance_attached_file');
sfContext::getInstance()->getLogger()->debug('(Jsni) $listJApplianceAttachedFile = ' .$listJApplianceAttachedFile);  // 

$listDetailForm = $this->fillTableWithValueFromFormJsni();
$this->saveJApplAndJApplAttFileJsni($job, $listJApplianceAttachedCV, $listJApplianceAttachedFile, $listDetailForm);
// End Sauvegarde


//  ... rest of the code  

As it said, you want to concatenate a string with an array. Use var_dump to output the value of $listJApplianceAttachedCV . I don't really know symfon1 or 2, I only do some practicing in 2 but if php says you want to use an array as a string, it must be right and you should really check what is the value of your variable before falling into despair.

Its good practice to check the type of your variable, before throwing it directly into a string. It seems you have set an array in the users session. See more documentation about getAttribute method

If you want the array as string, use 'implode'

Usage of implode for a multidimensional array

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM