Exemplo n.º 1
0
 public function __construct($object = null, $quantity = 1)
 {
     if (is_array($object)) {
         parent::__construct($object);
     } else {
         parent::__construct();
     }
 }
Exemplo n.º 2
0
 public function __construct($object = null, $quantity = 1)
 {
     // Case 1: Constructed by getting OrderItem from DB
     if (is_array($object)) {
         $this->_quantity = $object['Quantity'];
     }
     // Case 2: Constructed in memory
     if (is_object($object)) {
         $this->_quantity = $quantity;
     }
     parent::__construct();
 }