public function preSave(ConnectionInterface $con = null) { if ($this->isPaid() && null === $this->getInvoiceDate()) { $this->setInvoiceDate(time()); } return parent::preSave($con); }
/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['OrderProduct'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['OrderProduct'][$this->getPrimaryKey()] = true; $keys = OrderProductTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getOrderId(), $keys[2] => $this->getProductRef(), $keys[3] => $this->getProductSaleElementsRef(), $keys[4] => $this->getProductSaleElementsId(), $keys[5] => $this->getTitle(), $keys[6] => $this->getChapo(), $keys[7] => $this->getDescription(), $keys[8] => $this->getPostscriptum(), $keys[9] => $this->getQuantity(), $keys[10] => $this->getPrice(), $keys[11] => $this->getPromoPrice(), $keys[12] => $this->getWasNew(), $keys[13] => $this->getWasInPromo(), $keys[14] => $this->getWeight(), $keys[15] => $this->getEanCode(), $keys[16] => $this->getTaxRuleTitle(), $keys[17] => $this->getTaxRuleDescription(), $keys[18] => $this->getParent(), $keys[19] => $this->getVirtual(), $keys[20] => $this->getVirtualDocument(), $keys[21] => $this->getCreatedAt(), $keys[22] => $this->getUpdatedAt()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aOrder) { $result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collOrderProductAttributeCombinations) { $result['OrderProductAttributeCombinations'] = $this->collOrderProductAttributeCombinations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collOrderProductTaxes) { $result['OrderProductTaxes'] = $this->collOrderProductTaxes->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }
/** * @param Order $order The order object to add. */ protected function doAddOrder($order) { $this->collOrders[] = $order; $order->setCustomer($this); }
/** * @param Order $order The order object to add. */ protected function doAddOrder($order) { $this->collOrders[] = $order; $order->setOrderStatus($this); }
/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['OrderCoupon'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['OrderCoupon'][$this->getPrimaryKey()] = true; $keys = OrderCouponTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getOrderId(), $keys[2] => $this->getCode(), $keys[3] => $this->getType(), $keys[4] => $this->getAmount(), $keys[5] => $this->getTitle(), $keys[6] => $this->getShortDescription(), $keys[7] => $this->getDescription(), $keys[8] => $this->getExpirationDate(), $keys[9] => $this->getIsCumulative(), $keys[10] => $this->getIsRemovingPostage(), $keys[11] => $this->getIsAvailableOnSpecialOffers(), $keys[12] => $this->getSerializedConditions(), $keys[13] => $this->getPerCustomerUsageCount(), $keys[14] => $this->getCreatedAt(), $keys[15] => $this->getUpdatedAt()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aOrder) { $result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collOrderCouponCountries) { $result['OrderCouponCountries'] = $this->collOrderCouponCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collOrderCouponModules) { $result['OrderCouponModules'] = $this->collOrderCouponModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }
/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['OrderVersion'][serialize($this->getPrimaryKey())])) { return '*RECURSION*'; } $alreadyDumpedObjects['OrderVersion'][serialize($this->getPrimaryKey())] = true; $keys = OrderVersionTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getRef(), $keys[2] => $this->getCustomerId(), $keys[3] => $this->getInvoiceOrderAddressId(), $keys[4] => $this->getDeliveryOrderAddressId(), $keys[5] => $this->getInvoiceDate(), $keys[6] => $this->getCurrencyId(), $keys[7] => $this->getCurrencyRate(), $keys[8] => $this->getTransactionRef(), $keys[9] => $this->getDeliveryRef(), $keys[10] => $this->getInvoiceRef(), $keys[11] => $this->getDiscount(), $keys[12] => $this->getPostage(), $keys[13] => $this->getPostageTax(), $keys[14] => $this->getPostageTaxRuleTitle(), $keys[15] => $this->getPaymentModuleId(), $keys[16] => $this->getDeliveryModuleId(), $keys[17] => $this->getStatusId(), $keys[18] => $this->getLangId(), $keys[19] => $this->getCartId(), $keys[20] => $this->getCreatedAt(), $keys[21] => $this->getUpdatedAt(), $keys[22] => $this->getVersion(), $keys[23] => $this->getVersionCreatedAt(), $keys[24] => $this->getVersionCreatedBy(), $keys[25] => $this->getCustomerIdVersion()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aOrder) { $result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }