我有一个名为翅膀的系列。每个翼的课程都有一对多的关系。对于一个翼,有多个类。
{
"_id": ObjectId("53db122b0cd7e32d148b4567"),
"name": "Senior",
"tenant": {
"$ref": "Tenant",
"$id": ObjectId("53887e53dda3aaac0600003b"),
"$db": "mydbName"
},
"classes": {
"0": {
"$ref": "StudentClass",
"$id": ObjectId("538c5cd9dda3aae409000029"),
"$db": "eduboldyps"
},
"1":{
"$ref": "StudentClass",
"$id": ObjectId("538c5cd9dda3aae40900002b"),
"$db": "eduboldyps"
}
}
}
因此,当我在控制器中获取数据时,如下所示:
$allWingsArray = array();
foreach($documents as $wings){
$innerWingsArrays = array();
$innerWingsArrays['name'] = $wings->getId();
$innerWingsArrays['name'] = $wings->getName();
//Get all Assigned wigns for each wing here
foreach($wings->getclasses() as $clss) {
$arrayclassess = array_values($clss);
//Herer I am getting Error
echo "<pre>"; print_r($arrayclassess);
}
$allWingsArray[] = $innerWingsArrays;
}
因此,在获取多个关系的类时,我遇到以下错误:
localhost:27017: Can't canonicalize query: BadValue $in needs an array
我正在使用MONGODB版本2.6.11和Symfony 2.3.7
任何帮助将不胜感激,如何解决这个问题。提前谢谢