setCart() public method

public setCart ( ECommerceCart $cart )
$cart ECommerceCart
Exemplo n.º 1
0
 public function setCustomer(ECommerceCustomer $customer)
 {
     if ($this->customer !== $customer) {
         $this->customer = $customer;
         $customer->setCart($this);
     }
 }
 public function testAcceptsForeignKeysAsCriteria()
 {
     $customer = new ECommerceCustomer();
     $customer->setName('John Doe');
     $cart = new ECommerceCart();
     $cart->setPayment('Credit card');
     $customer->setCart($cart);
     $this->_em->persist($customer);
     $this->_em->flush();
     $this->_em->clear();
     unset($cart);
     $class = $this->_em->getClassMetadata('Doctrine\\Tests\\Models\\ECommerce\\ECommerceCart');
     $persister = $this->_em->getUnitOfWork()->getEntityPersister('Doctrine\\Tests\\Models\\ECommerce\\ECommerceCart');
     $newCart = new ECommerceCart();
     $persister->load(array('customer_id' => $customer->getId()), $newCart, $class->associationMappings['customer']);
     $this->assertEquals('Credit card', $newCart->getPayment());
 }
 protected function _createFixture()
 {
     $customer = new ECommerceCustomer();
     $customer->setName('Giorgio');
     $cart = new ECommerceCart();
     $cart->setPayment('paypal');
     $customer->setCart($cart);
     $this->_em->persist($customer);
     $this->_em->flush();
     $this->_em->clear();
 }