propelを使用してクエリを実行しようとしていますが、50行のデータが返されますが、代わりに他の乱数が返されます。私は、私のpgphpadminでコピーされたクエリを印刷し、50行を返します。何が起こっているのか分かりません。また、 "find"の前に "count"関数を実行すると50を返しますが、それはランダムな量の行を返します。Propelがすべての行を返していない
$limit = 50;
$offset = 0;
..... //filters
$companies = $companies->orderById()->limit($limit)->offset($offset);
var_dump($companies->count()); // this returns 50
$companies = $companies->find();
var_dump($companies->count()); // this returns 13
また、foreachは13回だけ繰り返します。
そして、これは、クエリが、私は、問題は、私は削除するという事実から来るかもしれないと思うので、私はいつもこのクエリに問題があったPropelのバージョンは2.0-devの
ある
SELECT "company"."id", "company"."otherfields",
"lists"."id", "lists"."otherfields", "place"."id",
"place"."otherfields", "contact"."id", "contact"."otherfields",
"entry"."id","entry"."otherfields"
FROM "company" LEFT JOIN "lists" ON
("company"."sector_id"="lists"."id") LEFT JOIN "place" ON
("company"."country_id"="place"."id") LEFT JOIN "contact" ON
("company"."id"="contact"."company_id" AND "contact"."active" = true)
LEFT JOIN "entry" ON ("company"."id"="entry"."company_id")
WHERE "company"."active"=true ORDER BY "company"."id" ASC LIMIT 50 OFFSET 0
を生成しています1 をライブラリにスローします。私はwith()とlimit()を使っています。生成されたクエリはOKですが、結果は正しくありません。
変更Propel/Runtime/Formatter/ObjectFormatter.php 私はこれをコメントしました。
/*if ($this->hasLimit) {
throw new LogicException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.');
}*/
ここでエラーが発生する可能性があります。クエリに参加マイ
この
$companies->leftJoinWithLists()->leftJoinWithPlace()->leftJoinWithContact()->addJoinCondition('Contact','Contact.active = ?', true)->leftJoinWithEntry();
のように見えます。そして、私は制限を追加します。これを回避する方法はありますか他の方法ですか?