我有用户和帖子的集合。
用户看起来像
{ "_id" : ObjectId("5089cc4c7b03b9902b000000"), "facebook_id" : "522128874" }
帖子看起来像
{ "_id" : ObjectId("508aa21b7b03b9780800000f"), "facebook_id" : "10150709375878875", "user" : DBRef("User", ObjectId("5089cc4c7b03b9902b000000")), "message" : " Julia dream, dreamboat queen, queen of all my dreams", "updated_time" : 1333502938 }
我想查找特定用户的所有帖子。
$user = $userRepo->findOneByFacebookId('522128874');
$posts = $postRepo->findOneByUser($user)
它不起作用。我也试过
$posts = $postRepo->findOneBy(array('user' => $user))
和
$posts = $postRepo->findOneBy(array('user' => $user->getId()))