示例#1
0
 protected function getCustomerAddress(\Club\ShopBundle\Entity\Cart $cart)
 {
     $profile = $cart->getUser()->getProfile();
     $address = new \Club\ShopBundle\Entity\CartAddress();
     $address->setFirstName($profile->getFirstName());
     $address->setLastName($profile->getLastName());
     return $address;
 }
 public function getProductInCart(\Club\ShopBundle\Entity\Product $product, \Club\ShopBundle\Entity\Cart $cart)
 {
     return $this->createQueryBuilder('cp')->join('cp.cart', 'c')->join('cp.product', 'p')->where('c.id = :cart')->andWhere('p.id = :product')->setParameter('cart', $cart->getId())->setParameter('product', $product->getId())->getQuery()->getOneOrNullResult();
 }