Doctrine\Tests\Models\ECommerce\ECommerceCart::setCustomer PHP Method

setCustomer() public method

public setCustomer ( ECommerceCustomer $customer )
$customer ECommerceCustomer
    public function setCustomer(ECommerceCustomer $customer)
    {
        if ($this->customer !== $customer) {
            $this->customer = $customer;
            $customer->setCart($this);
        }
    }

Usage Example

コード例 #1
0
ファイル: DDC736Test.php プロジェクト: selimcr/servigases
 /**
  * @group DDC-736
  * @group DDC-925
  * @group DDC-915
  */
 public function testDqlTreeWalkerReordering()
 {
     $cust = new ECommerceCustomer();
     $cust->setName('roman');
     $cart = new ECommerceCart();
     $cart->setPayment('cash');
     $cart->setCustomer($cust);
     $this->_em->persist($cust);
     $this->_em->persist($cart);
     $this->_em->flush();
     $this->_em->clear();
     $dql = "select c, c.name, ca, ca.payment from Doctrine\\Tests\\Models\\ECommerce\\ECommerceCart ca join ca.customer c";
     $result = $this->_em->createQuery($dql)->setHint(Query::HINT_CUSTOM_TREE_WALKERS, array('Doctrine\\Tests\\ORM\\Functional\\Ticket\\DisableFetchJoinTreeWalker'))->getResult();
     /* @var $cart2 Doctrine\Tests\Models\ECommerce\ECommerceCart */
     $cart2 = $result[0][0];
     $this->assertInstanceOf('Doctrine\\ORM\\Proxy\\Proxy', $cart2->getCustomer());
 }
All Usage Examples Of Doctrine\Tests\Models\ECommerce\ECommerceCart::setCustomer