我有以下查询:
$em = $this->getEntityManager();
$query = $em->createQueryBuilder()->select('shoppingcart')
->from("AppMainBundle:ShoppingCart", 'shoppingcart')
->innerJoin('shoppingcart.shoppingCartProducts', 'shoppingcartproduct')
->innerJoin('shoppingcartproduct.product', 'product')
->innerJoin('shoppingcartproduct.productAttribute', 'productattribute')
->innerJoin('product.shop', 'shop')
;
如何编写 where 语句,我只想获取其中包含多个购物车产品的购物车?这里是购物车和购物车产品的关系:
class ShoppingCart
{
/**
* @var integer $id
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="ShoppingCartProduct", mappedBy="shoppingCart", cascade={"persist","remove"})
*/
protected $shoppingCartProducts;
}