1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
-
- namespace Doctrine\Tests\Models\ECommerce;
-
- use Doctrine\Common\Collections\ArrayCollection;
-
-
- class ECommerceCart
- {
-
-
- private $id;
-
-
-
- private $payment;
-
-
-
- private $customer;
-
-
-
- private $products;
-
- public function __construct()
- {
- $this->products = new ArrayCollection;
- }
-
- public function getId() {
- return $this->id;
- }
-
- public function getPayment() {
- return $this->payment;
- }
-
- public function setPayment($payment) {
- $this->payment = $payment;
- }
-
- public function setCustomer(ECommerceCustomer $customer) {
- if ($this->customer !== $customer) {
- $this->customer = $customer;
- $customer->setCart($this);
- }
- }
-
- public function removeCustomer() {
- if ($this->customer !== null) {
- $customer = $this->customer;
- $this->customer = null;
- $customer->removeCart();
- }
- }
-
- public function getCustomer() {
- return $this->customer;
- }
-
- public function getProducts()
- {
- return $this->products;
- }
-
- public function addProduct(ECommerceProduct $product) {
- $this->products[] = $product;
- }
-
- public function removeProduct(ECommerceProduct $product) {
- return $this->products->removeElement($product);
- }
- }
|