이 두 요청을 1로 병합하고 싶습니다. 그러나이 작업을 수행하는 방법에 대한 단서가 없습니다. 어떤 생각? Doctrine : 1에서 2 요청 합치기
$productsCount = Doctrine::getTable('Product')
->createQuery('p')
->where('p.store_id = ?', $store_id)
->andWhere('p.collection = ?', $this->product->getCollection())
->andWhere('p.image_path IS NOT NULL')
->count();
$productsCollection = Doctrine::getTable('Product')
->createQuery('p')
->where('p.store_id = ?', $store_id)
->andWhere('p.collection = ?', $this->product->getCollection())
->andWhere('p.status_id = ?', Product::_ONLINE)
->andWhere('p.id<>?', $this->product_id)
->offset(rand(0, $productsCount - 1))
->execute();
- 교리 : 1.2
- 심포니 : 1.4
- PHP : 조회가 동일하지 않기 때문에 5.3
: 나는 당신에게 교리 쿼리 최적화에 대한 흥미로운 프리젠 테이션을 추천? 이 2 개의 쿼리는 다른 정보를 반환합니다. 어떻게 병합 하시겠습니까? – j0k
2 개의 쿼리는 동일한 테이블을 사용하고 첫 번째 테이블은 두 번째 쿼리에서 사용되므로이 작업을 최적화하기 위해이 모든 작업을 수행하는 것이 더 나을 것이라고 생각했습니다. 하지만 아마도 내가 틀렸어? – MaximeBernard