Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我在项目中完成Messagebundle安装后提交查询时出错_Php_Symfony - Fatal编程技术网

Php 我在项目中完成Messagebundle安装后提交查询时出错

Php 我在项目中完成Messagebundle安装后提交查询时出错,php,symfony,Php,Symfony,我得到了这类错误: ContextErrorException:警告:为/var/www/html/imsdemo/vendor/friendsofsymfony/MessageBundle/FOS/MessageBundle/Entity/Thread.php第81行中的foreach()提供的参数无效 请帮我解决这个错误 protected function getParticipantsCollection() { if ($this->participants == nul

我得到了这类错误:

ContextErrorException:警告:为/var/www/html/imsdemo/vendor/friendsofsymfony/MessageBundle/FOS/MessageBundle/Entity/Thread.php第81行中的foreach()提供的参数无效

请帮我解决这个错误

protected function getParticipantsCollection()
{
    if ($this->participants == null) {
        $this->participants = new ArrayCollection();

/* Line 81*/ foreach ($this->metadata as $data) {
             $this->participants->add($data->getParticipant());
             }

    }

    return $this->participants;
}

这是给出错误的代码

我得到了为什么会发生的问题,因为每当我对数据库进行模式更新时,它会使用MyBundle/Resources/config/doctrine YML文件,该文件不会像FosMessageBundle那样更新我的数据库…因此,当我删除/config/doctrine文件夹,然后进行模式更新时,它工作正常

请提供您的代码。81号线上有什么?!请看,我在其中添加了代码@LorenzMeyer$this->元数据应该是一个数组,但它不是。你必须回到你的代码中。函数print\u debug\u backtrace()可能很有用。我也按原样执行了数组($this->metadata),但它在我的project@LorenzMeyer你知道它是怎么发生的吗