[Symfony \ Component \ Debug \ Exception \ ContextErrorException]注意:数组到字符串转换

时间:2017-10-12 02:20:10

标签: php symfony

在我的客户存储库中,我已经定义了一个函数findMapAllByIds(),如下所示:

/**
 * @apiParam $materialIdList [049c5355-6311-c251-16b7-9c923f8de2a4,0589775e-dcd3-c015-bd81-bba26df33c77,0bf7f653-c01a-d6e2-8cdc-1691c437e4eb]
 */
public function findMapAllByIds($materialIdList, $orderBy = 'createTime', $order = 'desc')
{
    $ids = array();

    $query = $this->createQueryBuilder('Material')
        ->field('_id')->in($materialIdList)
        ->sort($orderBy, $order)
        ->getQuery();

    $resultList = $query->execute();

    $resultMap = array();
    if (!empty($resultList)) {
        foreach ($resultList as $material) {
            $resultMap[(string) $material->getId()] = $material;
        }
    }

    return $resultMap;
}

然后,我收到了这个错误:

  

[Symfony的\元器件\调试\异常\ ContextErrorException]

     

注意:数组转换为字符串

0 个答案:

没有答案