Overview

Namespaces

  • PHP
  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvDesc
  • BaseAttributeAvDescPeer
  • BaseAttributeAvDescQuery
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeDesc
  • BaseAttributeDescPeer
  • BaseAttributeDescQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryDesc
  • BaseCategoryDescPeer
  • BaseCategoryDescQuery
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigDesc
  • BaseConfigDescPeer
  • BaseConfigDescQuery
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentDesc
  • BaseContentDescPeer
  • BaseContentDescQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryDesc
  • BaseCountryDescPeer
  • BaseCountryDescQuery
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleDesc
  • BaseCustomerTitleDescPeer
  • BaseCustomerTitleDescQuery
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentDesc
  • BaseDocumentDescPeer
  • BaseDocumentDescQuery
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvDesc
  • BaseFeatureAvDescPeer
  • BaseFeatureAvDescQuery
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureDesc
  • BaseFeatureDescPeer
  • BaseFeatureDescQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderDesc
  • BaseFolderDescPeer
  • BaseFolderDescQuery
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupDesc
  • BaseGroupDescPeer
  • BaseGroupDescQuery
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageDesc
  • BaseImageDescPeer
  • BaseImageDescQuery
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageDesc
  • BaseMessageDescPeer
  • BaseMessageDescQuery
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModuleDesc
  • BaseModuleDescPeer
  • BaseModuleDescQuery
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusDesc
  • BaseOrderStatusDescPeer
  • BaseOrderStatusDescQuery
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductDesc
  • BaseProductDescPeer
  • BaseProductDescQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceDesc
  • BaseResourceDescPeer
  • BaseResourceDescQuery
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxDesc
  • BaseTaxDescPeer
  • BaseTaxDescQuery
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleDesc
  • BaseTaxRuleDescPeer
  • BaseTaxRuleDescQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
   1: <?php
   2: 
   3: namespace Thelia\Model\om;
   4: 
   5: use \BasePeer;
   6: use \Criteria;
   7: use \PDO;
   8: use \PDOStatement;
   9: use \Propel;
  10: use \PropelException;
  11: use \PropelPDO;
  12: use Thelia\Model\CouponOrderPeer;
  13: use Thelia\Model\CurrencyPeer;
  14: use Thelia\Model\CustomerPeer;
  15: use Thelia\Model\Order;
  16: use Thelia\Model\OrderAddressPeer;
  17: use Thelia\Model\OrderPeer;
  18: use Thelia\Model\OrderProductPeer;
  19: use Thelia\Model\OrderStatusPeer;
  20: use Thelia\Model\map\OrderTableMap;
  21: 
  22: /**
  23:  * Base static class for performing query and update operations on the 'order' table.
  24:  *
  25:  *
  26:  *
  27:  * @package propel.generator.Thelia.Model.om
  28:  */
  29: abstract class BaseOrderPeer
  30: {
  31: 
  32:     /** the default database name for this class */
  33:     const DATABASE_NAME = 'thelia';
  34: 
  35:     /** the table name for this class */
  36:     const TABLE_NAME = 'order';
  37: 
  38:     /** the related Propel class for this table */
  39:     const OM_CLASS = 'Thelia\\Model\\Order';
  40: 
  41:     /** the related TableMap class for this table */
  42:     const TM_CLASS = 'OrderTableMap';
  43: 
  44:     /** The total number of columns. */
  45:     const NUM_COLUMNS = 18;
  46: 
  47:     /** The number of lazy-loaded columns. */
  48:     const NUM_LAZY_LOAD_COLUMNS = 0;
  49: 
  50:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
  51:     const NUM_HYDRATE_COLUMNS = 18;
  52: 
  53:     /** the column name for the ID field */
  54:     const ID = 'order.ID';
  55: 
  56:     /** the column name for the REF field */
  57:     const REF = 'order.REF';
  58: 
  59:     /** the column name for the CUSTOMER_ID field */
  60:     const CUSTOMER_ID = 'order.CUSTOMER_ID';
  61: 
  62:     /** the column name for the ADDRESS_INVOICE field */
  63:     const ADDRESS_INVOICE = 'order.ADDRESS_INVOICE';
  64: 
  65:     /** the column name for the ADDRESS_DELIVERY field */
  66:     const ADDRESS_DELIVERY = 'order.ADDRESS_DELIVERY';
  67: 
  68:     /** the column name for the INVOICE_DATE field */
  69:     const INVOICE_DATE = 'order.INVOICE_DATE';
  70: 
  71:     /** the column name for the CURRENCY_ID field */
  72:     const CURRENCY_ID = 'order.CURRENCY_ID';
  73: 
  74:     /** the column name for the CURRENCY_RATE field */
  75:     const CURRENCY_RATE = 'order.CURRENCY_RATE';
  76: 
  77:     /** the column name for the TRANSACTION field */
  78:     const TRANSACTION = 'order.TRANSACTION';
  79: 
  80:     /** the column name for the DELIVERY_NUM field */
  81:     const DELIVERY_NUM = 'order.DELIVERY_NUM';
  82: 
  83:     /** the column name for the INVOICE field */
  84:     const INVOICE = 'order.INVOICE';
  85: 
  86:     /** the column name for the POSTAGE field */
  87:     const POSTAGE = 'order.POSTAGE';
  88: 
  89:     /** the column name for the PAYMENT field */
  90:     const PAYMENT = 'order.PAYMENT';
  91: 
  92:     /** the column name for the CARRIER field */
  93:     const CARRIER = 'order.CARRIER';
  94: 
  95:     /** the column name for the STATUS_ID field */
  96:     const STATUS_ID = 'order.STATUS_ID';
  97: 
  98:     /** the column name for the LANG field */
  99:     const LANG = 'order.LANG';
 100: 
 101:     /** the column name for the CREATED_AT field */
 102:     const CREATED_AT = 'order.CREATED_AT';
 103: 
 104:     /** the column name for the UPDATED_AT field */
 105:     const UPDATED_AT = 'order.UPDATED_AT';
 106: 
 107:     /** The default string format for model objects of the related table **/
 108:     const DEFAULT_STRING_FORMAT = 'YAML';
 109: 
 110:     /**
 111:      * An identiy map to hold any loaded instances of Order objects.
 112:      * This must be public so that other peer classes can access this when hydrating from JOIN
 113:      * queries.
 114:      * @var        array Order[]
 115:      */
 116:     public static $instances = array();
 117: 
 118: 
 119:     /**
 120:      * holds an array of fieldnames
 121:      *
 122:      * first dimension keys are the type constants
 123:      * e.g. OrderPeer::$fieldNames[OrderPeer::TYPE_PHPNAME][0] = 'Id'
 124:      */
 125:     protected static $fieldNames = array (
 126:         BasePeer::TYPE_PHPNAME => array ('Id', 'Ref', 'CustomerId', 'AddressInvoice', 'AddressDelivery', 'InvoiceDate', 'CurrencyId', 'CurrencyRate', 'Transaction', 'DeliveryNum', 'Invoice', 'Postage', 'Payment', 'Carrier', 'StatusId', 'Lang', 'CreatedAt', 'UpdatedAt', ),
 127:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'ref', 'customerId', 'addressInvoice', 'addressDelivery', 'invoiceDate', 'currencyId', 'currencyRate', 'transaction', 'deliveryNum', 'invoice', 'postage', 'payment', 'carrier', 'statusId', 'lang', 'createdAt', 'updatedAt', ),
 128:         BasePeer::TYPE_COLNAME => array (OrderPeer::ID, OrderPeer::REF, OrderPeer::CUSTOMER_ID, OrderPeer::ADDRESS_INVOICE, OrderPeer::ADDRESS_DELIVERY, OrderPeer::INVOICE_DATE, OrderPeer::CURRENCY_ID, OrderPeer::CURRENCY_RATE, OrderPeer::TRANSACTION, OrderPeer::DELIVERY_NUM, OrderPeer::INVOICE, OrderPeer::POSTAGE, OrderPeer::PAYMENT, OrderPeer::CARRIER, OrderPeer::STATUS_ID, OrderPeer::LANG, OrderPeer::CREATED_AT, OrderPeer::UPDATED_AT, ),
 129:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'REF', 'CUSTOMER_ID', 'ADDRESS_INVOICE', 'ADDRESS_DELIVERY', 'INVOICE_DATE', 'CURRENCY_ID', 'CURRENCY_RATE', 'TRANSACTION', 'DELIVERY_NUM', 'INVOICE', 'POSTAGE', 'PAYMENT', 'CARRIER', 'STATUS_ID', 'LANG', 'CREATED_AT', 'UPDATED_AT', ),
 130:         BasePeer::TYPE_FIELDNAME => array ('id', 'ref', 'customer_id', 'address_invoice', 'address_delivery', 'invoice_date', 'currency_id', 'currency_rate', 'transaction', 'delivery_num', 'invoice', 'postage', 'payment', 'carrier', 'status_id', 'lang', 'created_at', 'updated_at', ),
 131:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
 132:     );
 133: 
 134:     /**
 135:      * holds an array of keys for quick access to the fieldnames array
 136:      *
 137:      * first dimension keys are the type constants
 138:      * e.g. OrderPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
 139:      */
 140:     protected static $fieldKeys = array (
 141:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Ref' => 1, 'CustomerId' => 2, 'AddressInvoice' => 3, 'AddressDelivery' => 4, 'InvoiceDate' => 5, 'CurrencyId' => 6, 'CurrencyRate' => 7, 'Transaction' => 8, 'DeliveryNum' => 9, 'Invoice' => 10, 'Postage' => 11, 'Payment' => 12, 'Carrier' => 13, 'StatusId' => 14, 'Lang' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
 142:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'ref' => 1, 'customerId' => 2, 'addressInvoice' => 3, 'addressDelivery' => 4, 'invoiceDate' => 5, 'currencyId' => 6, 'currencyRate' => 7, 'transaction' => 8, 'deliveryNum' => 9, 'invoice' => 10, 'postage' => 11, 'payment' => 12, 'carrier' => 13, 'statusId' => 14, 'lang' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
 143:         BasePeer::TYPE_COLNAME => array (OrderPeer::ID => 0, OrderPeer::REF => 1, OrderPeer::CUSTOMER_ID => 2, OrderPeer::ADDRESS_INVOICE => 3, OrderPeer::ADDRESS_DELIVERY => 4, OrderPeer::INVOICE_DATE => 5, OrderPeer::CURRENCY_ID => 6, OrderPeer::CURRENCY_RATE => 7, OrderPeer::TRANSACTION => 8, OrderPeer::DELIVERY_NUM => 9, OrderPeer::INVOICE => 10, OrderPeer::POSTAGE => 11, OrderPeer::PAYMENT => 12, OrderPeer::CARRIER => 13, OrderPeer::STATUS_ID => 14, OrderPeer::LANG => 15, OrderPeer::CREATED_AT => 16, OrderPeer::UPDATED_AT => 17, ),
 144:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'REF' => 1, 'CUSTOMER_ID' => 2, 'ADDRESS_INVOICE' => 3, 'ADDRESS_DELIVERY' => 4, 'INVOICE_DATE' => 5, 'CURRENCY_ID' => 6, 'CURRENCY_RATE' => 7, 'TRANSACTION' => 8, 'DELIVERY_NUM' => 9, 'INVOICE' => 10, 'POSTAGE' => 11, 'PAYMENT' => 12, 'CARRIER' => 13, 'STATUS_ID' => 14, 'LANG' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
 145:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'ref' => 1, 'customer_id' => 2, 'address_invoice' => 3, 'address_delivery' => 4, 'invoice_date' => 5, 'currency_id' => 6, 'currency_rate' => 7, 'transaction' => 8, 'delivery_num' => 9, 'invoice' => 10, 'postage' => 11, 'payment' => 12, 'carrier' => 13, 'status_id' => 14, 'lang' => 15, 'created_at' => 16, 'updated_at' => 17, ),
 146:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
 147:     );
 148: 
 149:     /**
 150:      * Translates a fieldname to another type
 151:      *
 152:      * @param      string $name field name
 153:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 154:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 155:      * @param      string $toType   One of the class type constants
 156:      * @return string          translated name of the field.
 157:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
 158:      */
 159:     public static function translateFieldName($name, $fromType, $toType)
 160:     {
 161:         $toNames = OrderPeer::getFieldNames($toType);
 162:         $key = isset(OrderPeer::$fieldKeys[$fromType][$name]) ? OrderPeer::$fieldKeys[$fromType][$name] : null;
 163:         if ($key === null) {
 164:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(OrderPeer::$fieldKeys[$fromType], true));
 165:         }
 166: 
 167:         return $toNames[$key];
 168:     }
 169: 
 170:     /**
 171:      * Returns an array of field names.
 172:      *
 173:      * @param      string $type The type of fieldnames to return:
 174:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 175:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 176:      * @return array           A list of field names
 177:      * @throws PropelException - if the type is not valid.
 178:      */
 179:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
 180:     {
 181:         if (!array_key_exists($type, OrderPeer::$fieldNames)) {
 182:             throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
 183:         }
 184: 
 185:         return OrderPeer::$fieldNames[$type];
 186:     }
 187: 
 188:     /**
 189:      * Convenience method which changes table.column to alias.column.
 190:      *
 191:      * Using this method you can maintain SQL abstraction while using column aliases.
 192:      * <code>
 193:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
 194:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
 195:      * </code>
 196:      * @param      string $alias The alias for the current table.
 197:      * @param      string $column The column name for current table. (i.e. OrderPeer::COLUMN_NAME).
 198:      * @return string
 199:      */
 200:     public static function alias($alias, $column)
 201:     {
 202:         return str_replace(OrderPeer::TABLE_NAME.'.', $alias.'.', $column);
 203:     }
 204: 
 205:     /**
 206:      * Add all the columns needed to create a new object.
 207:      *
 208:      * Note: any columns that were marked with lazyLoad="true" in the
 209:      * XML schema will not be added to the select list and only loaded
 210:      * on demand.
 211:      *
 212:      * @param      Criteria $criteria object containing the columns to add.
 213:      * @param      string   $alias    optional table alias
 214:      * @throws PropelException Any exceptions caught during processing will be
 215:      *       rethrown wrapped into a PropelException.
 216:      */
 217:     public static function addSelectColumns(Criteria $criteria, $alias = null)
 218:     {
 219:         if (null === $alias) {
 220:             $criteria->addSelectColumn(OrderPeer::ID);
 221:             $criteria->addSelectColumn(OrderPeer::REF);
 222:             $criteria->addSelectColumn(OrderPeer::CUSTOMER_ID);
 223:             $criteria->addSelectColumn(OrderPeer::ADDRESS_INVOICE);
 224:             $criteria->addSelectColumn(OrderPeer::ADDRESS_DELIVERY);
 225:             $criteria->addSelectColumn(OrderPeer::INVOICE_DATE);
 226:             $criteria->addSelectColumn(OrderPeer::CURRENCY_ID);
 227:             $criteria->addSelectColumn(OrderPeer::CURRENCY_RATE);
 228:             $criteria->addSelectColumn(OrderPeer::TRANSACTION);
 229:             $criteria->addSelectColumn(OrderPeer::DELIVERY_NUM);
 230:             $criteria->addSelectColumn(OrderPeer::INVOICE);
 231:             $criteria->addSelectColumn(OrderPeer::POSTAGE);
 232:             $criteria->addSelectColumn(OrderPeer::PAYMENT);
 233:             $criteria->addSelectColumn(OrderPeer::CARRIER);
 234:             $criteria->addSelectColumn(OrderPeer::STATUS_ID);
 235:             $criteria->addSelectColumn(OrderPeer::LANG);
 236:             $criteria->addSelectColumn(OrderPeer::CREATED_AT);
 237:             $criteria->addSelectColumn(OrderPeer::UPDATED_AT);
 238:         } else {
 239:             $criteria->addSelectColumn($alias . '.ID');
 240:             $criteria->addSelectColumn($alias . '.REF');
 241:             $criteria->addSelectColumn($alias . '.CUSTOMER_ID');
 242:             $criteria->addSelectColumn($alias . '.ADDRESS_INVOICE');
 243:             $criteria->addSelectColumn($alias . '.ADDRESS_DELIVERY');
 244:             $criteria->addSelectColumn($alias . '.INVOICE_DATE');
 245:             $criteria->addSelectColumn($alias . '.CURRENCY_ID');
 246:             $criteria->addSelectColumn($alias . '.CURRENCY_RATE');
 247:             $criteria->addSelectColumn($alias . '.TRANSACTION');
 248:             $criteria->addSelectColumn($alias . '.DELIVERY_NUM');
 249:             $criteria->addSelectColumn($alias . '.INVOICE');
 250:             $criteria->addSelectColumn($alias . '.POSTAGE');
 251:             $criteria->addSelectColumn($alias . '.PAYMENT');
 252:             $criteria->addSelectColumn($alias . '.CARRIER');
 253:             $criteria->addSelectColumn($alias . '.STATUS_ID');
 254:             $criteria->addSelectColumn($alias . '.LANG');
 255:             $criteria->addSelectColumn($alias . '.CREATED_AT');
 256:             $criteria->addSelectColumn($alias . '.UPDATED_AT');
 257:         }
 258:     }
 259: 
 260:     /**
 261:      * Returns the number of rows matching criteria.
 262:      *
 263:      * @param      Criteria $criteria
 264:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 265:      * @param      PropelPDO $con
 266:      * @return int Number of matching rows.
 267:      */
 268:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 269:     {
 270:         // we may modify criteria, so copy it first
 271:         $criteria = clone $criteria;
 272: 
 273:         // We need to set the primary table name, since in the case that there are no WHERE columns
 274:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 275:         // tables go into the FROM clause.
 276:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
 277: 
 278:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 279:             $criteria->setDistinct();
 280:         }
 281: 
 282:         if (!$criteria->hasSelectClause()) {
 283:             OrderPeer::addSelectColumns($criteria);
 284:         }
 285: 
 286:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 287:         $criteria->setDbName(OrderPeer::DATABASE_NAME); // Set the correct dbName
 288: 
 289:         if ($con === null) {
 290:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 291:         }
 292:         // BasePeer returns a PDOStatement
 293:         $stmt = BasePeer::doCount($criteria, $con);
 294: 
 295:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 296:             $count = (int) $row[0];
 297:         } else {
 298:             $count = 0; // no rows returned; we infer that means 0 matches.
 299:         }
 300:         $stmt->closeCursor();
 301: 
 302:         return $count;
 303:     }
 304:     /**
 305:      * Selects one object from the DB.
 306:      *
 307:      * @param      Criteria $criteria object used to create the SELECT statement.
 308:      * @param      PropelPDO $con
 309:      * @return                 Order
 310:      * @throws PropelException Any exceptions caught during processing will be
 311:      *       rethrown wrapped into a PropelException.
 312:      */
 313:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
 314:     {
 315:         $critcopy = clone $criteria;
 316:         $critcopy->setLimit(1);
 317:         $objects = OrderPeer::doSelect($critcopy, $con);
 318:         if ($objects) {
 319:             return $objects[0];
 320:         }
 321: 
 322:         return null;
 323:     }
 324:     /**
 325:      * Selects several row from the DB.
 326:      *
 327:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 328:      * @param      PropelPDO $con
 329:      * @return array           Array of selected Objects
 330:      * @throws PropelException Any exceptions caught during processing will be
 331:      *       rethrown wrapped into a PropelException.
 332:      */
 333:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 334:     {
 335:         return OrderPeer::populateObjects(OrderPeer::doSelectStmt($criteria, $con));
 336:     }
 337:     /**
 338:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
 339:      *
 340:      * Use this method directly if you want to work with an executed statement durirectly (for example
 341:      * to perform your own object hydration).
 342:      *
 343:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 344:      * @param      PropelPDO $con The connection to use
 345:      * @throws PropelException Any exceptions caught during processing will be
 346:      *       rethrown wrapped into a PropelException.
 347:      * @return PDOStatement The executed PDOStatement object.
 348:      * @see        BasePeer::doSelect()
 349:      */
 350:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
 351:     {
 352:         if ($con === null) {
 353:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 354:         }
 355: 
 356:         if (!$criteria->hasSelectClause()) {
 357:             $criteria = clone $criteria;
 358:             OrderPeer::addSelectColumns($criteria);
 359:         }
 360: 
 361:         // Set the correct dbName
 362:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
 363: 
 364:         // BasePeer returns a PDOStatement
 365:         return BasePeer::doSelect($criteria, $con);
 366:     }
 367:     /**
 368:      * Adds an object to the instance pool.
 369:      *
 370:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 371:      * from the database.  In some cases -- especially when you override doSelect*()
 372:      * methods in your stub classes -- you may need to explicitly add objects
 373:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
 374:      * and retrieveByPK*() calls.
 375:      *
 376:      * @param      Order $obj A Order object.
 377:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
 378:      */
 379:     public static function addInstanceToPool($obj, $key = null)
 380:     {
 381:         if (Propel::isInstancePoolingEnabled()) {
 382:             if ($key === null) {
 383:                 $key = (string) $obj->getId();
 384:             } // if key === null
 385:             OrderPeer::$instances[$key] = $obj;
 386:         }
 387:     }
 388: 
 389:     /**
 390:      * Removes an object from the instance pool.
 391:      *
 392:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 393:      * from the database.  In some cases -- especially when you override doDelete
 394:      * methods in your stub classes -- you may need to explicitly remove objects
 395:      * from the cache in order to prevent returning objects that no longer exist.
 396:      *
 397:      * @param      mixed $value A Order object or a primary key value.
 398:      *
 399:      * @return void
 400:      * @throws PropelException - if the value is invalid.
 401:      */
 402:     public static function removeInstanceFromPool($value)
 403:     {
 404:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
 405:             if (is_object($value) && $value instanceof Order) {
 406:                 $key = (string) $value->getId();
 407:             } elseif (is_scalar($value)) {
 408:                 // assume we've been passed a primary key
 409:                 $key = (string) $value;
 410:             } else {
 411:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Order object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
 412:                 throw $e;
 413:             }
 414: 
 415:             unset(OrderPeer::$instances[$key]);
 416:         }
 417:     } // removeInstanceFromPool()
 418: 
 419:     /**
 420:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 421:      *
 422:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 423:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 424:      *
 425:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
 426:      * @return   Order Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
 427:      * @see        getPrimaryKeyHash()
 428:      */
 429:     public static function getInstanceFromPool($key)
 430:     {
 431:         if (Propel::isInstancePoolingEnabled()) {
 432:             if (isset(OrderPeer::$instances[$key])) {
 433:                 return OrderPeer::$instances[$key];
 434:             }
 435:         }
 436: 
 437:         return null; // just to be explicit
 438:     }
 439: 
 440:     /**
 441:      * Clear the instance pool.
 442:      *
 443:      * @return void
 444:      */
 445:     public static function clearInstancePool()
 446:     {
 447:         OrderPeer::$instances = array();
 448:     }
 449: 
 450:     /**
 451:      * Method to invalidate the instance pool of all tables related to order
 452:      * by a foreign key with ON DELETE CASCADE
 453:      */
 454:     public static function clearRelatedInstancePool()
 455:     {
 456:         // Invalidate objects in OrderProductPeer instance pool,
 457:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
 458:         OrderProductPeer::clearInstancePool();
 459:         // Invalidate objects in CouponOrderPeer instance pool,
 460:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
 461:         CouponOrderPeer::clearInstancePool();
 462:     }
 463: 
 464:     /**
 465:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 466:      *
 467:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 468:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 469:      *
 470:      * @param      array $row PropelPDO resultset row.
 471:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 472:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 473:      */
 474:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 475:     {
 476:         // If the PK cannot be derived from the row, return null.
 477:         if ($row[$startcol] === null) {
 478:             return null;
 479:         }
 480: 
 481:         return (string) $row[$startcol];
 482:     }
 483: 
 484:     /**
 485:      * Retrieves the primary key from the DB resultset row
 486:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 487:      * a multi-column primary key, an array of the primary key columns will be returned.
 488:      *
 489:      * @param      array $row PropelPDO resultset row.
 490:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 491:      * @return mixed The primary key of the row
 492:      */
 493:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 494:     {
 495: 
 496:         return (int) $row[$startcol];
 497:     }
 498: 
 499:     /**
 500:      * The returned array will contain objects of the default type or
 501:      * objects that inherit from the default.
 502:      *
 503:      * @throws PropelException Any exceptions caught during processing will be
 504:      *       rethrown wrapped into a PropelException.
 505:      */
 506:     public static function populateObjects(PDOStatement $stmt)
 507:     {
 508:         $results = array();
 509: 
 510:         // set the class once to avoid overhead in the loop
 511:         $cls = OrderPeer::getOMClass();
 512:         // populate the object(s)
 513:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 514:             $key = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
 515:             if (null !== ($obj = OrderPeer::getInstanceFromPool($key))) {
 516:                 // We no longer rehydrate the object, since this can cause data loss.
 517:                 // See http://www.propelorm.org/ticket/509
 518:                 // $obj->hydrate($row, 0, true); // rehydrate
 519:                 $results[] = $obj;
 520:             } else {
 521:                 $obj = new $cls();
 522:                 $obj->hydrate($row);
 523:                 $results[] = $obj;
 524:                 OrderPeer::addInstanceToPool($obj, $key);
 525:             } // if key exists
 526:         }
 527:         $stmt->closeCursor();
 528: 
 529:         return $results;
 530:     }
 531:     /**
 532:      * Populates an object of the default type or an object that inherit from the default.
 533:      *
 534:      * @param      array $row PropelPDO resultset row.
 535:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 536:      * @throws PropelException Any exceptions caught during processing will be
 537:      *       rethrown wrapped into a PropelException.
 538:      * @return array (Order object, last column rank)
 539:      */
 540:     public static function populateObject($row, $startcol = 0)
 541:     {
 542:         $key = OrderPeer::getPrimaryKeyHashFromRow($row, $startcol);
 543:         if (null !== ($obj = OrderPeer::getInstanceFromPool($key))) {
 544:             // We no longer rehydrate the object, since this can cause data loss.
 545:             // See http://www.propelorm.org/ticket/509
 546:             // $obj->hydrate($row, $startcol, true); // rehydrate
 547:             $col = $startcol + OrderPeer::NUM_HYDRATE_COLUMNS;
 548:         } else {
 549:             $cls = OrderPeer::OM_CLASS;
 550:             $obj = new $cls();
 551:             $col = $obj->hydrate($row, $startcol);
 552:             OrderPeer::addInstanceToPool($obj, $key);
 553:         }
 554: 
 555:         return array($obj, $col);
 556:     }
 557: 
 558: 
 559:     /**
 560:      * Returns the number of rows matching criteria, joining the related Currency table
 561:      *
 562:      * @param      Criteria $criteria
 563:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 564:      * @param      PropelPDO $con
 565:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 566:      * @return int Number of matching rows.
 567:      */
 568:     public static function doCountJoinCurrency(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 569:     {
 570:         // we're going to modify criteria, so copy it first
 571:         $criteria = clone $criteria;
 572: 
 573:         // We need to set the primary table name, since in the case that there are no WHERE columns
 574:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 575:         // tables go into the FROM clause.
 576:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
 577: 
 578:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 579:             $criteria->setDistinct();
 580:         }
 581: 
 582:         if (!$criteria->hasSelectClause()) {
 583:             OrderPeer::addSelectColumns($criteria);
 584:         }
 585: 
 586:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 587: 
 588:         // Set the correct dbName
 589:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
 590: 
 591:         if ($con === null) {
 592:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 593:         }
 594: 
 595:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
 596: 
 597:         $stmt = BasePeer::doCount($criteria, $con);
 598: 
 599:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 600:             $count = (int) $row[0];
 601:         } else {
 602:             $count = 0; // no rows returned; we infer that means 0 matches.
 603:         }
 604:         $stmt->closeCursor();
 605: 
 606:         return $count;
 607:     }
 608: 
 609: 
 610:     /**
 611:      * Returns the number of rows matching criteria, joining the related Customer table
 612:      *
 613:      * @param      Criteria $criteria
 614:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 615:      * @param      PropelPDO $con
 616:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 617:      * @return int Number of matching rows.
 618:      */
 619:     public static function doCountJoinCustomer(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 620:     {
 621:         // we're going to modify criteria, so copy it first
 622:         $criteria = clone $criteria;
 623: 
 624:         // We need to set the primary table name, since in the case that there are no WHERE columns
 625:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 626:         // tables go into the FROM clause.
 627:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
 628: 
 629:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 630:             $criteria->setDistinct();
 631:         }
 632: 
 633:         if (!$criteria->hasSelectClause()) {
 634:             OrderPeer::addSelectColumns($criteria);
 635:         }
 636: 
 637:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 638: 
 639:         // Set the correct dbName
 640:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
 641: 
 642:         if ($con === null) {
 643:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 644:         }
 645: 
 646:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
 647: 
 648:         $stmt = BasePeer::doCount($criteria, $con);
 649: 
 650:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 651:             $count = (int) $row[0];
 652:         } else {
 653:             $count = 0; // no rows returned; we infer that means 0 matches.
 654:         }
 655:         $stmt->closeCursor();
 656: 
 657:         return $count;
 658:     }
 659: 
 660: 
 661:     /**
 662:      * Returns the number of rows matching criteria, joining the related OrderAddressRelatedByAddressInvoice table
 663:      *
 664:      * @param      Criteria $criteria
 665:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 666:      * @param      PropelPDO $con
 667:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 668:      * @return int Number of matching rows.
 669:      */
 670:     public static function doCountJoinOrderAddressRelatedByAddressInvoice(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 671:     {
 672:         // we're going to modify criteria, so copy it first
 673:         $criteria = clone $criteria;
 674: 
 675:         // We need to set the primary table name, since in the case that there are no WHERE columns
 676:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 677:         // tables go into the FROM clause.
 678:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
 679: 
 680:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 681:             $criteria->setDistinct();
 682:         }
 683: 
 684:         if (!$criteria->hasSelectClause()) {
 685:             OrderPeer::addSelectColumns($criteria);
 686:         }
 687: 
 688:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 689: 
 690:         // Set the correct dbName
 691:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
 692: 
 693:         if ($con === null) {
 694:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 695:         }
 696: 
 697:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
 698: 
 699:         $stmt = BasePeer::doCount($criteria, $con);
 700: 
 701:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 702:             $count = (int) $row[0];
 703:         } else {
 704:             $count = 0; // no rows returned; we infer that means 0 matches.
 705:         }
 706:         $stmt->closeCursor();
 707: 
 708:         return $count;
 709:     }
 710: 
 711: 
 712:     /**
 713:      * Returns the number of rows matching criteria, joining the related OrderAddressRelatedByAddressDelivery table
 714:      *
 715:      * @param      Criteria $criteria
 716:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 717:      * @param      PropelPDO $con
 718:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 719:      * @return int Number of matching rows.
 720:      */
 721:     public static function doCountJoinOrderAddressRelatedByAddressDelivery(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 722:     {
 723:         // we're going to modify criteria, so copy it first
 724:         $criteria = clone $criteria;
 725: 
 726:         // We need to set the primary table name, since in the case that there are no WHERE columns
 727:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 728:         // tables go into the FROM clause.
 729:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
 730: 
 731:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 732:             $criteria->setDistinct();
 733:         }
 734: 
 735:         if (!$criteria->hasSelectClause()) {
 736:             OrderPeer::addSelectColumns($criteria);
 737:         }
 738: 
 739:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 740: 
 741:         // Set the correct dbName
 742:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
 743: 
 744:         if ($con === null) {
 745:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 746:         }
 747: 
 748:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
 749: 
 750:         $stmt = BasePeer::doCount($criteria, $con);
 751: 
 752:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 753:             $count = (int) $row[0];
 754:         } else {
 755:             $count = 0; // no rows returned; we infer that means 0 matches.
 756:         }
 757:         $stmt->closeCursor();
 758: 
 759:         return $count;
 760:     }
 761: 
 762: 
 763:     /**
 764:      * Returns the number of rows matching criteria, joining the related OrderStatus table
 765:      *
 766:      * @param      Criteria $criteria
 767:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 768:      * @param      PropelPDO $con
 769:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 770:      * @return int Number of matching rows.
 771:      */
 772:     public static function doCountJoinOrderStatus(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 773:     {
 774:         // we're going to modify criteria, so copy it first
 775:         $criteria = clone $criteria;
 776: 
 777:         // We need to set the primary table name, since in the case that there are no WHERE columns
 778:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 779:         // tables go into the FROM clause.
 780:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
 781: 
 782:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 783:             $criteria->setDistinct();
 784:         }
 785: 
 786:         if (!$criteria->hasSelectClause()) {
 787:             OrderPeer::addSelectColumns($criteria);
 788:         }
 789: 
 790:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 791: 
 792:         // Set the correct dbName
 793:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
 794: 
 795:         if ($con === null) {
 796:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 797:         }
 798: 
 799:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
 800: 
 801:         $stmt = BasePeer::doCount($criteria, $con);
 802: 
 803:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 804:             $count = (int) $row[0];
 805:         } else {
 806:             $count = 0; // no rows returned; we infer that means 0 matches.
 807:         }
 808:         $stmt->closeCursor();
 809: 
 810:         return $count;
 811:     }
 812: 
 813: 
 814:     /**
 815:      * Selects a collection of Order objects pre-filled with their Currency objects.
 816:      * @param      Criteria  $criteria
 817:      * @param      PropelPDO $con
 818:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 819:      * @return array           Array of Order objects.
 820:      * @throws PropelException Any exceptions caught during processing will be
 821:      *       rethrown wrapped into a PropelException.
 822:      */
 823:     public static function doSelectJoinCurrency(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 824:     {
 825:         $criteria = clone $criteria;
 826: 
 827:         // Set the correct dbName if it has not been overridden
 828:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 829:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
 830:         }
 831: 
 832:         OrderPeer::addSelectColumns($criteria);
 833:         $startcol = OrderPeer::NUM_HYDRATE_COLUMNS;
 834:         CurrencyPeer::addSelectColumns($criteria);
 835: 
 836:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
 837: 
 838:         $stmt = BasePeer::doSelect($criteria, $con);
 839:         $results = array();
 840: 
 841:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 842:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
 843:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
 844:                 // We no longer rehydrate the object, since this can cause data loss.
 845:                 // See http://www.propelorm.org/ticket/509
 846:                 // $obj1->hydrate($row, 0, true); // rehydrate
 847:             } else {
 848: 
 849:                 $cls = OrderPeer::getOMClass();
 850: 
 851:                 $obj1 = new $cls();
 852:                 $obj1->hydrate($row);
 853:                 OrderPeer::addInstanceToPool($obj1, $key1);
 854:             } // if $obj1 already loaded
 855: 
 856:             $key2 = CurrencyPeer::getPrimaryKeyHashFromRow($row, $startcol);
 857:             if ($key2 !== null) {
 858:                 $obj2 = CurrencyPeer::getInstanceFromPool($key2);
 859:                 if (!$obj2) {
 860: 
 861:                     $cls = CurrencyPeer::getOMClass();
 862: 
 863:                     $obj2 = new $cls();
 864:                     $obj2->hydrate($row, $startcol);
 865:                     CurrencyPeer::addInstanceToPool($obj2, $key2);
 866:                 } // if obj2 already loaded
 867: 
 868:                 // Add the $obj1 (Order) to $obj2 (Currency)
 869:                 $obj2->addOrder($obj1);
 870: 
 871:             } // if joined row was not null
 872: 
 873:             $results[] = $obj1;
 874:         }
 875:         $stmt->closeCursor();
 876: 
 877:         return $results;
 878:     }
 879: 
 880: 
 881:     /**
 882:      * Selects a collection of Order objects pre-filled with their Customer objects.
 883:      * @param      Criteria  $criteria
 884:      * @param      PropelPDO $con
 885:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 886:      * @return array           Array of Order objects.
 887:      * @throws PropelException Any exceptions caught during processing will be
 888:      *       rethrown wrapped into a PropelException.
 889:      */
 890:     public static function doSelectJoinCustomer(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 891:     {
 892:         $criteria = clone $criteria;
 893: 
 894:         // Set the correct dbName if it has not been overridden
 895:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 896:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
 897:         }
 898: 
 899:         OrderPeer::addSelectColumns($criteria);
 900:         $startcol = OrderPeer::NUM_HYDRATE_COLUMNS;
 901:         CustomerPeer::addSelectColumns($criteria);
 902: 
 903:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
 904: 
 905:         $stmt = BasePeer::doSelect($criteria, $con);
 906:         $results = array();
 907: 
 908:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 909:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
 910:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
 911:                 // We no longer rehydrate the object, since this can cause data loss.
 912:                 // See http://www.propelorm.org/ticket/509
 913:                 // $obj1->hydrate($row, 0, true); // rehydrate
 914:             } else {
 915: 
 916:                 $cls = OrderPeer::getOMClass();
 917: 
 918:                 $obj1 = new $cls();
 919:                 $obj1->hydrate($row);
 920:                 OrderPeer::addInstanceToPool($obj1, $key1);
 921:             } // if $obj1 already loaded
 922: 
 923:             $key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol);
 924:             if ($key2 !== null) {
 925:                 $obj2 = CustomerPeer::getInstanceFromPool($key2);
 926:                 if (!$obj2) {
 927: 
 928:                     $cls = CustomerPeer::getOMClass();
 929: 
 930:                     $obj2 = new $cls();
 931:                     $obj2->hydrate($row, $startcol);
 932:                     CustomerPeer::addInstanceToPool($obj2, $key2);
 933:                 } // if obj2 already loaded
 934: 
 935:                 // Add the $obj1 (Order) to $obj2 (Customer)
 936:                 $obj2->addOrder($obj1);
 937: 
 938:             } // if joined row was not null
 939: 
 940:             $results[] = $obj1;
 941:         }
 942:         $stmt->closeCursor();
 943: 
 944:         return $results;
 945:     }
 946: 
 947: 
 948:     /**
 949:      * Selects a collection of Order objects pre-filled with their OrderAddress objects.
 950:      * @param      Criteria  $criteria
 951:      * @param      PropelPDO $con
 952:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 953:      * @return array           Array of Order objects.
 954:      * @throws PropelException Any exceptions caught during processing will be
 955:      *       rethrown wrapped into a PropelException.
 956:      */
 957:     public static function doSelectJoinOrderAddressRelatedByAddressInvoice(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 958:     {
 959:         $criteria = clone $criteria;
 960: 
 961:         // Set the correct dbName if it has not been overridden
 962:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 963:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
 964:         }
 965: 
 966:         OrderPeer::addSelectColumns($criteria);
 967:         $startcol = OrderPeer::NUM_HYDRATE_COLUMNS;
 968:         OrderAddressPeer::addSelectColumns($criteria);
 969: 
 970:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
 971: 
 972:         $stmt = BasePeer::doSelect($criteria, $con);
 973:         $results = array();
 974: 
 975:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 976:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
 977:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
 978:                 // We no longer rehydrate the object, since this can cause data loss.
 979:                 // See http://www.propelorm.org/ticket/509
 980:                 // $obj1->hydrate($row, 0, true); // rehydrate
 981:             } else {
 982: 
 983:                 $cls = OrderPeer::getOMClass();
 984: 
 985:                 $obj1 = new $cls();
 986:                 $obj1->hydrate($row);
 987:                 OrderPeer::addInstanceToPool($obj1, $key1);
 988:             } // if $obj1 already loaded
 989: 
 990:             $key2 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol);
 991:             if ($key2 !== null) {
 992:                 $obj2 = OrderAddressPeer::getInstanceFromPool($key2);
 993:                 if (!$obj2) {
 994: 
 995:                     $cls = OrderAddressPeer::getOMClass();
 996: 
 997:                     $obj2 = new $cls();
 998:                     $obj2->hydrate($row, $startcol);
 999:                     OrderAddressPeer::addInstanceToPool($obj2, $key2);
1000:                 } // if obj2 already loaded
1001: 
1002:                 // Add the $obj1 (Order) to $obj2 (OrderAddress)
1003:                 $obj2->addOrderRelatedByAddressInvoice($obj1);
1004: 
1005:             } // if joined row was not null
1006: 
1007:             $results[] = $obj1;
1008:         }
1009:         $stmt->closeCursor();
1010: 
1011:         return $results;
1012:     }
1013: 
1014: 
1015:     /**
1016:      * Selects a collection of Order objects pre-filled with their OrderAddress objects.
1017:      * @param      Criteria  $criteria
1018:      * @param      PropelPDO $con
1019:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1020:      * @return array           Array of Order objects.
1021:      * @throws PropelException Any exceptions caught during processing will be
1022:      *       rethrown wrapped into a PropelException.
1023:      */
1024:     public static function doSelectJoinOrderAddressRelatedByAddressDelivery(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1025:     {
1026:         $criteria = clone $criteria;
1027: 
1028:         // Set the correct dbName if it has not been overridden
1029:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1030:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
1031:         }
1032: 
1033:         OrderPeer::addSelectColumns($criteria);
1034:         $startcol = OrderPeer::NUM_HYDRATE_COLUMNS;
1035:         OrderAddressPeer::addSelectColumns($criteria);
1036: 
1037:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1038: 
1039:         $stmt = BasePeer::doSelect($criteria, $con);
1040:         $results = array();
1041: 
1042:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1043:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
1044:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
1045:                 // We no longer rehydrate the object, since this can cause data loss.
1046:                 // See http://www.propelorm.org/ticket/509
1047:                 // $obj1->hydrate($row, 0, true); // rehydrate
1048:             } else {
1049: 
1050:                 $cls = OrderPeer::getOMClass();
1051: 
1052:                 $obj1 = new $cls();
1053:                 $obj1->hydrate($row);
1054:                 OrderPeer::addInstanceToPool($obj1, $key1);
1055:             } // if $obj1 already loaded
1056: 
1057:             $key2 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol);
1058:             if ($key2 !== null) {
1059:                 $obj2 = OrderAddressPeer::getInstanceFromPool($key2);
1060:                 if (!$obj2) {
1061: 
1062:                     $cls = OrderAddressPeer::getOMClass();
1063: 
1064:                     $obj2 = new $cls();
1065:                     $obj2->hydrate($row, $startcol);
1066:                     OrderAddressPeer::addInstanceToPool($obj2, $key2);
1067:                 } // if obj2 already loaded
1068: 
1069:                 // Add the $obj1 (Order) to $obj2 (OrderAddress)
1070:                 $obj2->addOrderRelatedByAddressDelivery($obj1);
1071: 
1072:             } // if joined row was not null
1073: 
1074:             $results[] = $obj1;
1075:         }
1076:         $stmt->closeCursor();
1077: 
1078:         return $results;
1079:     }
1080: 
1081: 
1082:     /**
1083:      * Selects a collection of Order objects pre-filled with their OrderStatus objects.
1084:      * @param      Criteria  $criteria
1085:      * @param      PropelPDO $con
1086:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1087:      * @return array           Array of Order objects.
1088:      * @throws PropelException Any exceptions caught during processing will be
1089:      *       rethrown wrapped into a PropelException.
1090:      */
1091:     public static function doSelectJoinOrderStatus(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1092:     {
1093:         $criteria = clone $criteria;
1094: 
1095:         // Set the correct dbName if it has not been overridden
1096:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1097:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
1098:         }
1099: 
1100:         OrderPeer::addSelectColumns($criteria);
1101:         $startcol = OrderPeer::NUM_HYDRATE_COLUMNS;
1102:         OrderStatusPeer::addSelectColumns($criteria);
1103: 
1104:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1105: 
1106:         $stmt = BasePeer::doSelect($criteria, $con);
1107:         $results = array();
1108: 
1109:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1110:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
1111:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
1112:                 // We no longer rehydrate the object, since this can cause data loss.
1113:                 // See http://www.propelorm.org/ticket/509
1114:                 // $obj1->hydrate($row, 0, true); // rehydrate
1115:             } else {
1116: 
1117:                 $cls = OrderPeer::getOMClass();
1118: 
1119:                 $obj1 = new $cls();
1120:                 $obj1->hydrate($row);
1121:                 OrderPeer::addInstanceToPool($obj1, $key1);
1122:             } // if $obj1 already loaded
1123: 
1124:             $key2 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol);
1125:             if ($key2 !== null) {
1126:                 $obj2 = OrderStatusPeer::getInstanceFromPool($key2);
1127:                 if (!$obj2) {
1128: 
1129:                     $cls = OrderStatusPeer::getOMClass();
1130: 
1131:                     $obj2 = new $cls();
1132:                     $obj2->hydrate($row, $startcol);
1133:                     OrderStatusPeer::addInstanceToPool($obj2, $key2);
1134:                 } // if obj2 already loaded
1135: 
1136:                 // Add the $obj1 (Order) to $obj2 (OrderStatus)
1137:                 $obj2->addOrder($obj1);
1138: 
1139:             } // if joined row was not null
1140: 
1141:             $results[] = $obj1;
1142:         }
1143:         $stmt->closeCursor();
1144: 
1145:         return $results;
1146:     }
1147: 
1148: 
1149:     /**
1150:      * Returns the number of rows matching criteria, joining all related tables
1151:      *
1152:      * @param      Criteria $criteria
1153:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1154:      * @param      PropelPDO $con
1155:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1156:      * @return int Number of matching rows.
1157:      */
1158:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1159:     {
1160:         // we're going to modify criteria, so copy it first
1161:         $criteria = clone $criteria;
1162: 
1163:         // We need to set the primary table name, since in the case that there are no WHERE columns
1164:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1165:         // tables go into the FROM clause.
1166:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
1167: 
1168:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1169:             $criteria->setDistinct();
1170:         }
1171: 
1172:         if (!$criteria->hasSelectClause()) {
1173:             OrderPeer::addSelectColumns($criteria);
1174:         }
1175: 
1176:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
1177: 
1178:         // Set the correct dbName
1179:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
1180: 
1181:         if ($con === null) {
1182:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1183:         }
1184: 
1185:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1186: 
1187:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1188: 
1189:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
1190: 
1191:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1192: 
1193:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1194: 
1195:         $stmt = BasePeer::doCount($criteria, $con);
1196: 
1197:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1198:             $count = (int) $row[0];
1199:         } else {
1200:             $count = 0; // no rows returned; we infer that means 0 matches.
1201:         }
1202:         $stmt->closeCursor();
1203: 
1204:         return $count;
1205:     }
1206: 
1207:     /**
1208:      * Selects a collection of Order objects pre-filled with all related objects.
1209:      *
1210:      * @param      Criteria  $criteria
1211:      * @param      PropelPDO $con
1212:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1213:      * @return array           Array of Order objects.
1214:      * @throws PropelException Any exceptions caught during processing will be
1215:      *       rethrown wrapped into a PropelException.
1216:      */
1217:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1218:     {
1219:         $criteria = clone $criteria;
1220: 
1221:         // Set the correct dbName if it has not been overridden
1222:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1223:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
1224:         }
1225: 
1226:         OrderPeer::addSelectColumns($criteria);
1227:         $startcol2 = OrderPeer::NUM_HYDRATE_COLUMNS;
1228: 
1229:         CurrencyPeer::addSelectColumns($criteria);
1230:         $startcol3 = $startcol2 + CurrencyPeer::NUM_HYDRATE_COLUMNS;
1231: 
1232:         CustomerPeer::addSelectColumns($criteria);
1233:         $startcol4 = $startcol3 + CustomerPeer::NUM_HYDRATE_COLUMNS;
1234: 
1235:         OrderAddressPeer::addSelectColumns($criteria);
1236:         $startcol5 = $startcol4 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
1237: 
1238:         OrderAddressPeer::addSelectColumns($criteria);
1239:         $startcol6 = $startcol5 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
1240: 
1241:         OrderStatusPeer::addSelectColumns($criteria);
1242:         $startcol7 = $startcol6 + OrderStatusPeer::NUM_HYDRATE_COLUMNS;
1243: 
1244:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1245: 
1246:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1247: 
1248:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
1249: 
1250:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1251: 
1252:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1253: 
1254:         $stmt = BasePeer::doSelect($criteria, $con);
1255:         $results = array();
1256: 
1257:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1258:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
1259:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
1260:                 // We no longer rehydrate the object, since this can cause data loss.
1261:                 // See http://www.propelorm.org/ticket/509
1262:                 // $obj1->hydrate($row, 0, true); // rehydrate
1263:             } else {
1264:                 $cls = OrderPeer::getOMClass();
1265: 
1266:                 $obj1 = new $cls();
1267:                 $obj1->hydrate($row);
1268:                 OrderPeer::addInstanceToPool($obj1, $key1);
1269:             } // if obj1 already loaded
1270: 
1271:             // Add objects for joined Currency rows
1272: 
1273:             $key2 = CurrencyPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1274:             if ($key2 !== null) {
1275:                 $obj2 = CurrencyPeer::getInstanceFromPool($key2);
1276:                 if (!$obj2) {
1277: 
1278:                     $cls = CurrencyPeer::getOMClass();
1279: 
1280:                     $obj2 = new $cls();
1281:                     $obj2->hydrate($row, $startcol2);
1282:                     CurrencyPeer::addInstanceToPool($obj2, $key2);
1283:                 } // if obj2 loaded
1284: 
1285:                 // Add the $obj1 (Order) to the collection in $obj2 (Currency)
1286:                 $obj2->addOrder($obj1);
1287:             } // if joined row not null
1288: 
1289:             // Add objects for joined Customer rows
1290: 
1291:             $key3 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1292:             if ($key3 !== null) {
1293:                 $obj3 = CustomerPeer::getInstanceFromPool($key3);
1294:                 if (!$obj3) {
1295: 
1296:                     $cls = CustomerPeer::getOMClass();
1297: 
1298:                     $obj3 = new $cls();
1299:                     $obj3->hydrate($row, $startcol3);
1300:                     CustomerPeer::addInstanceToPool($obj3, $key3);
1301:                 } // if obj3 loaded
1302: 
1303:                 // Add the $obj1 (Order) to the collection in $obj3 (Customer)
1304:                 $obj3->addOrder($obj1);
1305:             } // if joined row not null
1306: 
1307:             // Add objects for joined OrderAddress rows
1308: 
1309:             $key4 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1310:             if ($key4 !== null) {
1311:                 $obj4 = OrderAddressPeer::getInstanceFromPool($key4);
1312:                 if (!$obj4) {
1313: 
1314:                     $cls = OrderAddressPeer::getOMClass();
1315: 
1316:                     $obj4 = new $cls();
1317:                     $obj4->hydrate($row, $startcol4);
1318:                     OrderAddressPeer::addInstanceToPool($obj4, $key4);
1319:                 } // if obj4 loaded
1320: 
1321:                 // Add the $obj1 (Order) to the collection in $obj4 (OrderAddress)
1322:                 $obj4->addOrderRelatedByAddressInvoice($obj1);
1323:             } // if joined row not null
1324: 
1325:             // Add objects for joined OrderAddress rows
1326: 
1327:             $key5 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol5);
1328:             if ($key5 !== null) {
1329:                 $obj5 = OrderAddressPeer::getInstanceFromPool($key5);
1330:                 if (!$obj5) {
1331: 
1332:                     $cls = OrderAddressPeer::getOMClass();
1333: 
1334:                     $obj5 = new $cls();
1335:                     $obj5->hydrate($row, $startcol5);
1336:                     OrderAddressPeer::addInstanceToPool($obj5, $key5);
1337:                 } // if obj5 loaded
1338: 
1339:                 // Add the $obj1 (Order) to the collection in $obj5 (OrderAddress)
1340:                 $obj5->addOrderRelatedByAddressDelivery($obj1);
1341:             } // if joined row not null
1342: 
1343:             // Add objects for joined OrderStatus rows
1344: 
1345:             $key6 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol6);
1346:             if ($key6 !== null) {
1347:                 $obj6 = OrderStatusPeer::getInstanceFromPool($key6);
1348:                 if (!$obj6) {
1349: 
1350:                     $cls = OrderStatusPeer::getOMClass();
1351: 
1352:                     $obj6 = new $cls();
1353:                     $obj6->hydrate($row, $startcol6);
1354:                     OrderStatusPeer::addInstanceToPool($obj6, $key6);
1355:                 } // if obj6 loaded
1356: 
1357:                 // Add the $obj1 (Order) to the collection in $obj6 (OrderStatus)
1358:                 $obj6->addOrder($obj1);
1359:             } // if joined row not null
1360: 
1361:             $results[] = $obj1;
1362:         }
1363:         $stmt->closeCursor();
1364: 
1365:         return $results;
1366:     }
1367: 
1368: 
1369:     /**
1370:      * Returns the number of rows matching criteria, joining the related Currency table
1371:      *
1372:      * @param      Criteria $criteria
1373:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1374:      * @param      PropelPDO $con
1375:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1376:      * @return int Number of matching rows.
1377:      */
1378:     public static function doCountJoinAllExceptCurrency(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1379:     {
1380:         // we're going to modify criteria, so copy it first
1381:         $criteria = clone $criteria;
1382: 
1383:         // We need to set the primary table name, since in the case that there are no WHERE columns
1384:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1385:         // tables go into the FROM clause.
1386:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
1387: 
1388:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1389:             $criteria->setDistinct();
1390:         }
1391: 
1392:         if (!$criteria->hasSelectClause()) {
1393:             OrderPeer::addSelectColumns($criteria);
1394:         }
1395: 
1396:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1397: 
1398:         // Set the correct dbName
1399:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
1400: 
1401:         if ($con === null) {
1402:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1403:         }
1404: 
1405:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1406: 
1407:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
1408: 
1409:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1410: 
1411:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1412: 
1413:         $stmt = BasePeer::doCount($criteria, $con);
1414: 
1415:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1416:             $count = (int) $row[0];
1417:         } else {
1418:             $count = 0; // no rows returned; we infer that means 0 matches.
1419:         }
1420:         $stmt->closeCursor();
1421: 
1422:         return $count;
1423:     }
1424: 
1425: 
1426:     /**
1427:      * Returns the number of rows matching criteria, joining the related Customer table
1428:      *
1429:      * @param      Criteria $criteria
1430:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1431:      * @param      PropelPDO $con
1432:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1433:      * @return int Number of matching rows.
1434:      */
1435:     public static function doCountJoinAllExceptCustomer(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1436:     {
1437:         // we're going to modify criteria, so copy it first
1438:         $criteria = clone $criteria;
1439: 
1440:         // We need to set the primary table name, since in the case that there are no WHERE columns
1441:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1442:         // tables go into the FROM clause.
1443:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
1444: 
1445:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1446:             $criteria->setDistinct();
1447:         }
1448: 
1449:         if (!$criteria->hasSelectClause()) {
1450:             OrderPeer::addSelectColumns($criteria);
1451:         }
1452: 
1453:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1454: 
1455:         // Set the correct dbName
1456:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
1457: 
1458:         if ($con === null) {
1459:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1460:         }
1461: 
1462:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1463: 
1464:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
1465: 
1466:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1467: 
1468:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1469: 
1470:         $stmt = BasePeer::doCount($criteria, $con);
1471: 
1472:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1473:             $count = (int) $row[0];
1474:         } else {
1475:             $count = 0; // no rows returned; we infer that means 0 matches.
1476:         }
1477:         $stmt->closeCursor();
1478: 
1479:         return $count;
1480:     }
1481: 
1482: 
1483:     /**
1484:      * Returns the number of rows matching criteria, joining the related OrderAddressRelatedByAddressInvoice table
1485:      *
1486:      * @param      Criteria $criteria
1487:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1488:      * @param      PropelPDO $con
1489:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1490:      * @return int Number of matching rows.
1491:      */
1492:     public static function doCountJoinAllExceptOrderAddressRelatedByAddressInvoice(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1493:     {
1494:         // we're going to modify criteria, so copy it first
1495:         $criteria = clone $criteria;
1496: 
1497:         // We need to set the primary table name, since in the case that there are no WHERE columns
1498:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1499:         // tables go into the FROM clause.
1500:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
1501: 
1502:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1503:             $criteria->setDistinct();
1504:         }
1505: 
1506:         if (!$criteria->hasSelectClause()) {
1507:             OrderPeer::addSelectColumns($criteria);
1508:         }
1509: 
1510:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1511: 
1512:         // Set the correct dbName
1513:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
1514: 
1515:         if ($con === null) {
1516:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1517:         }
1518: 
1519:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1520: 
1521:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1522: 
1523:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1524: 
1525:         $stmt = BasePeer::doCount($criteria, $con);
1526: 
1527:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1528:             $count = (int) $row[0];
1529:         } else {
1530:             $count = 0; // no rows returned; we infer that means 0 matches.
1531:         }
1532:         $stmt->closeCursor();
1533: 
1534:         return $count;
1535:     }
1536: 
1537: 
1538:     /**
1539:      * Returns the number of rows matching criteria, joining the related OrderAddressRelatedByAddressDelivery table
1540:      *
1541:      * @param      Criteria $criteria
1542:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1543:      * @param      PropelPDO $con
1544:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1545:      * @return int Number of matching rows.
1546:      */
1547:     public static function doCountJoinAllExceptOrderAddressRelatedByAddressDelivery(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1548:     {
1549:         // we're going to modify criteria, so copy it first
1550:         $criteria = clone $criteria;
1551: 
1552:         // We need to set the primary table name, since in the case that there are no WHERE columns
1553:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1554:         // tables go into the FROM clause.
1555:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
1556: 
1557:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1558:             $criteria->setDistinct();
1559:         }
1560: 
1561:         if (!$criteria->hasSelectClause()) {
1562:             OrderPeer::addSelectColumns($criteria);
1563:         }
1564: 
1565:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1566: 
1567:         // Set the correct dbName
1568:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
1569: 
1570:         if ($con === null) {
1571:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1572:         }
1573: 
1574:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1575: 
1576:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1577: 
1578:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1579: 
1580:         $stmt = BasePeer::doCount($criteria, $con);
1581: 
1582:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1583:             $count = (int) $row[0];
1584:         } else {
1585:             $count = 0; // no rows returned; we infer that means 0 matches.
1586:         }
1587:         $stmt->closeCursor();
1588: 
1589:         return $count;
1590:     }
1591: 
1592: 
1593:     /**
1594:      * Returns the number of rows matching criteria, joining the related OrderStatus table
1595:      *
1596:      * @param      Criteria $criteria
1597:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
1598:      * @param      PropelPDO $con
1599:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1600:      * @return int Number of matching rows.
1601:      */
1602:     public static function doCountJoinAllExceptOrderStatus(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
1603:     {
1604:         // we're going to modify criteria, so copy it first
1605:         $criteria = clone $criteria;
1606: 
1607:         // We need to set the primary table name, since in the case that there are no WHERE columns
1608:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
1609:         // tables go into the FROM clause.
1610:         $criteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
1611: 
1612:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
1613:             $criteria->setDistinct();
1614:         }
1615: 
1616:         if (!$criteria->hasSelectClause()) {
1617:             OrderPeer::addSelectColumns($criteria);
1618:         }
1619: 
1620:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
1621: 
1622:         // Set the correct dbName
1623:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
1624: 
1625:         if ($con === null) {
1626:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1627:         }
1628: 
1629:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1630: 
1631:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1632: 
1633:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
1634: 
1635:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1636: 
1637:         $stmt = BasePeer::doCount($criteria, $con);
1638: 
1639:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1640:             $count = (int) $row[0];
1641:         } else {
1642:             $count = 0; // no rows returned; we infer that means 0 matches.
1643:         }
1644:         $stmt->closeCursor();
1645: 
1646:         return $count;
1647:     }
1648: 
1649: 
1650:     /**
1651:      * Selects a collection of Order objects pre-filled with all related objects except Currency.
1652:      *
1653:      * @param      Criteria  $criteria
1654:      * @param      PropelPDO $con
1655:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1656:      * @return array           Array of Order objects.
1657:      * @throws PropelException Any exceptions caught during processing will be
1658:      *       rethrown wrapped into a PropelException.
1659:      */
1660:     public static function doSelectJoinAllExceptCurrency(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1661:     {
1662:         $criteria = clone $criteria;
1663: 
1664:         // Set the correct dbName if it has not been overridden
1665:         // $criteria->getDbName() will return the same object if not set to another value
1666:         // so == check is okay and faster
1667:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1668:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
1669:         }
1670: 
1671:         OrderPeer::addSelectColumns($criteria);
1672:         $startcol2 = OrderPeer::NUM_HYDRATE_COLUMNS;
1673: 
1674:         CustomerPeer::addSelectColumns($criteria);
1675:         $startcol3 = $startcol2 + CustomerPeer::NUM_HYDRATE_COLUMNS;
1676: 
1677:         OrderAddressPeer::addSelectColumns($criteria);
1678:         $startcol4 = $startcol3 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
1679: 
1680:         OrderAddressPeer::addSelectColumns($criteria);
1681:         $startcol5 = $startcol4 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
1682: 
1683:         OrderStatusPeer::addSelectColumns($criteria);
1684:         $startcol6 = $startcol5 + OrderStatusPeer::NUM_HYDRATE_COLUMNS;
1685: 
1686:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1687: 
1688:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
1689: 
1690:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1691: 
1692:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1693: 
1694: 
1695:         $stmt = BasePeer::doSelect($criteria, $con);
1696:         $results = array();
1697: 
1698:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1699:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
1700:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
1701:                 // We no longer rehydrate the object, since this can cause data loss.
1702:                 // See http://www.propelorm.org/ticket/509
1703:                 // $obj1->hydrate($row, 0, true); // rehydrate
1704:             } else {
1705:                 $cls = OrderPeer::getOMClass();
1706: 
1707:                 $obj1 = new $cls();
1708:                 $obj1->hydrate($row);
1709:                 OrderPeer::addInstanceToPool($obj1, $key1);
1710:             } // if obj1 already loaded
1711: 
1712:                 // Add objects for joined Customer rows
1713: 
1714:                 $key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1715:                 if ($key2 !== null) {
1716:                     $obj2 = CustomerPeer::getInstanceFromPool($key2);
1717:                     if (!$obj2) {
1718: 
1719:                         $cls = CustomerPeer::getOMClass();
1720: 
1721:                     $obj2 = new $cls();
1722:                     $obj2->hydrate($row, $startcol2);
1723:                     CustomerPeer::addInstanceToPool($obj2, $key2);
1724:                 } // if $obj2 already loaded
1725: 
1726:                 // Add the $obj1 (Order) to the collection in $obj2 (Customer)
1727:                 $obj2->addOrder($obj1);
1728: 
1729:             } // if joined row is not null
1730: 
1731:                 // Add objects for joined OrderAddress rows
1732: 
1733:                 $key3 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1734:                 if ($key3 !== null) {
1735:                     $obj3 = OrderAddressPeer::getInstanceFromPool($key3);
1736:                     if (!$obj3) {
1737: 
1738:                         $cls = OrderAddressPeer::getOMClass();
1739: 
1740:                     $obj3 = new $cls();
1741:                     $obj3->hydrate($row, $startcol3);
1742:                     OrderAddressPeer::addInstanceToPool($obj3, $key3);
1743:                 } // if $obj3 already loaded
1744: 
1745:                 // Add the $obj1 (Order) to the collection in $obj3 (OrderAddress)
1746:                 $obj3->addOrderRelatedByAddressInvoice($obj1);
1747: 
1748:             } // if joined row is not null
1749: 
1750:                 // Add objects for joined OrderAddress rows
1751: 
1752:                 $key4 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1753:                 if ($key4 !== null) {
1754:                     $obj4 = OrderAddressPeer::getInstanceFromPool($key4);
1755:                     if (!$obj4) {
1756: 
1757:                         $cls = OrderAddressPeer::getOMClass();
1758: 
1759:                     $obj4 = new $cls();
1760:                     $obj4->hydrate($row, $startcol4);
1761:                     OrderAddressPeer::addInstanceToPool($obj4, $key4);
1762:                 } // if $obj4 already loaded
1763: 
1764:                 // Add the $obj1 (Order) to the collection in $obj4 (OrderAddress)
1765:                 $obj4->addOrderRelatedByAddressDelivery($obj1);
1766: 
1767:             } // if joined row is not null
1768: 
1769:                 // Add objects for joined OrderStatus rows
1770: 
1771:                 $key5 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol5);
1772:                 if ($key5 !== null) {
1773:                     $obj5 = OrderStatusPeer::getInstanceFromPool($key5);
1774:                     if (!$obj5) {
1775: 
1776:                         $cls = OrderStatusPeer::getOMClass();
1777: 
1778:                     $obj5 = new $cls();
1779:                     $obj5->hydrate($row, $startcol5);
1780:                     OrderStatusPeer::addInstanceToPool($obj5, $key5);
1781:                 } // if $obj5 already loaded
1782: 
1783:                 // Add the $obj1 (Order) to the collection in $obj5 (OrderStatus)
1784:                 $obj5->addOrder($obj1);
1785: 
1786:             } // if joined row is not null
1787: 
1788:             $results[] = $obj1;
1789:         }
1790:         $stmt->closeCursor();
1791: 
1792:         return $results;
1793:     }
1794: 
1795: 
1796:     /**
1797:      * Selects a collection of Order objects pre-filled with all related objects except Customer.
1798:      *
1799:      * @param      Criteria  $criteria
1800:      * @param      PropelPDO $con
1801:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1802:      * @return array           Array of Order objects.
1803:      * @throws PropelException Any exceptions caught during processing will be
1804:      *       rethrown wrapped into a PropelException.
1805:      */
1806:     public static function doSelectJoinAllExceptCustomer(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1807:     {
1808:         $criteria = clone $criteria;
1809: 
1810:         // Set the correct dbName if it has not been overridden
1811:         // $criteria->getDbName() will return the same object if not set to another value
1812:         // so == check is okay and faster
1813:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1814:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
1815:         }
1816: 
1817:         OrderPeer::addSelectColumns($criteria);
1818:         $startcol2 = OrderPeer::NUM_HYDRATE_COLUMNS;
1819: 
1820:         CurrencyPeer::addSelectColumns($criteria);
1821:         $startcol3 = $startcol2 + CurrencyPeer::NUM_HYDRATE_COLUMNS;
1822: 
1823:         OrderAddressPeer::addSelectColumns($criteria);
1824:         $startcol4 = $startcol3 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
1825: 
1826:         OrderAddressPeer::addSelectColumns($criteria);
1827:         $startcol5 = $startcol4 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
1828: 
1829:         OrderStatusPeer::addSelectColumns($criteria);
1830:         $startcol6 = $startcol5 + OrderStatusPeer::NUM_HYDRATE_COLUMNS;
1831: 
1832:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1833: 
1834:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
1835: 
1836:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
1837: 
1838:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1839: 
1840: 
1841:         $stmt = BasePeer::doSelect($criteria, $con);
1842:         $results = array();
1843: 
1844:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1845:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
1846:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
1847:                 // We no longer rehydrate the object, since this can cause data loss.
1848:                 // See http://www.propelorm.org/ticket/509
1849:                 // $obj1->hydrate($row, 0, true); // rehydrate
1850:             } else {
1851:                 $cls = OrderPeer::getOMClass();
1852: 
1853:                 $obj1 = new $cls();
1854:                 $obj1->hydrate($row);
1855:                 OrderPeer::addInstanceToPool($obj1, $key1);
1856:             } // if obj1 already loaded
1857: 
1858:                 // Add objects for joined Currency rows
1859: 
1860:                 $key2 = CurrencyPeer::getPrimaryKeyHashFromRow($row, $startcol2);
1861:                 if ($key2 !== null) {
1862:                     $obj2 = CurrencyPeer::getInstanceFromPool($key2);
1863:                     if (!$obj2) {
1864: 
1865:                         $cls = CurrencyPeer::getOMClass();
1866: 
1867:                     $obj2 = new $cls();
1868:                     $obj2->hydrate($row, $startcol2);
1869:                     CurrencyPeer::addInstanceToPool($obj2, $key2);
1870:                 } // if $obj2 already loaded
1871: 
1872:                 // Add the $obj1 (Order) to the collection in $obj2 (Currency)
1873:                 $obj2->addOrder($obj1);
1874: 
1875:             } // if joined row is not null
1876: 
1877:                 // Add objects for joined OrderAddress rows
1878: 
1879:                 $key3 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol3);
1880:                 if ($key3 !== null) {
1881:                     $obj3 = OrderAddressPeer::getInstanceFromPool($key3);
1882:                     if (!$obj3) {
1883: 
1884:                         $cls = OrderAddressPeer::getOMClass();
1885: 
1886:                     $obj3 = new $cls();
1887:                     $obj3->hydrate($row, $startcol3);
1888:                     OrderAddressPeer::addInstanceToPool($obj3, $key3);
1889:                 } // if $obj3 already loaded
1890: 
1891:                 // Add the $obj1 (Order) to the collection in $obj3 (OrderAddress)
1892:                 $obj3->addOrderRelatedByAddressInvoice($obj1);
1893: 
1894:             } // if joined row is not null
1895: 
1896:                 // Add objects for joined OrderAddress rows
1897: 
1898:                 $key4 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol4);
1899:                 if ($key4 !== null) {
1900:                     $obj4 = OrderAddressPeer::getInstanceFromPool($key4);
1901:                     if (!$obj4) {
1902: 
1903:                         $cls = OrderAddressPeer::getOMClass();
1904: 
1905:                     $obj4 = new $cls();
1906:                     $obj4->hydrate($row, $startcol4);
1907:                     OrderAddressPeer::addInstanceToPool($obj4, $key4);
1908:                 } // if $obj4 already loaded
1909: 
1910:                 // Add the $obj1 (Order) to the collection in $obj4 (OrderAddress)
1911:                 $obj4->addOrderRelatedByAddressDelivery($obj1);
1912: 
1913:             } // if joined row is not null
1914: 
1915:                 // Add objects for joined OrderStatus rows
1916: 
1917:                 $key5 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol5);
1918:                 if ($key5 !== null) {
1919:                     $obj5 = OrderStatusPeer::getInstanceFromPool($key5);
1920:                     if (!$obj5) {
1921: 
1922:                         $cls = OrderStatusPeer::getOMClass();
1923: 
1924:                     $obj5 = new $cls();
1925:                     $obj5->hydrate($row, $startcol5);
1926:                     OrderStatusPeer::addInstanceToPool($obj5, $key5);
1927:                 } // if $obj5 already loaded
1928: 
1929:                 // Add the $obj1 (Order) to the collection in $obj5 (OrderStatus)
1930:                 $obj5->addOrder($obj1);
1931: 
1932:             } // if joined row is not null
1933: 
1934:             $results[] = $obj1;
1935:         }
1936:         $stmt->closeCursor();
1937: 
1938:         return $results;
1939:     }
1940: 
1941: 
1942:     /**
1943:      * Selects a collection of Order objects pre-filled with all related objects except OrderAddressRelatedByAddressInvoice.
1944:      *
1945:      * @param      Criteria  $criteria
1946:      * @param      PropelPDO $con
1947:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
1948:      * @return array           Array of Order objects.
1949:      * @throws PropelException Any exceptions caught during processing will be
1950:      *       rethrown wrapped into a PropelException.
1951:      */
1952:     public static function doSelectJoinAllExceptOrderAddressRelatedByAddressInvoice(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1953:     {
1954:         $criteria = clone $criteria;
1955: 
1956:         // Set the correct dbName if it has not been overridden
1957:         // $criteria->getDbName() will return the same object if not set to another value
1958:         // so == check is okay and faster
1959:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
1960:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
1961:         }
1962: 
1963:         OrderPeer::addSelectColumns($criteria);
1964:         $startcol2 = OrderPeer::NUM_HYDRATE_COLUMNS;
1965: 
1966:         CurrencyPeer::addSelectColumns($criteria);
1967:         $startcol3 = $startcol2 + CurrencyPeer::NUM_HYDRATE_COLUMNS;
1968: 
1969:         CustomerPeer::addSelectColumns($criteria);
1970:         $startcol4 = $startcol3 + CustomerPeer::NUM_HYDRATE_COLUMNS;
1971: 
1972:         OrderStatusPeer::addSelectColumns($criteria);
1973:         $startcol5 = $startcol4 + OrderStatusPeer::NUM_HYDRATE_COLUMNS;
1974: 
1975:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
1976: 
1977:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
1978: 
1979:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
1980: 
1981: 
1982:         $stmt = BasePeer::doSelect($criteria, $con);
1983:         $results = array();
1984: 
1985:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
1986:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
1987:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
1988:                 // We no longer rehydrate the object, since this can cause data loss.
1989:                 // See http://www.propelorm.org/ticket/509
1990:                 // $obj1->hydrate($row, 0, true); // rehydrate
1991:             } else {
1992:                 $cls = OrderPeer::getOMClass();
1993: 
1994:                 $obj1 = new $cls();
1995:                 $obj1->hydrate($row);
1996:                 OrderPeer::addInstanceToPool($obj1, $key1);
1997:             } // if obj1 already loaded
1998: 
1999:                 // Add objects for joined Currency rows
2000: 
2001:                 $key2 = CurrencyPeer::getPrimaryKeyHashFromRow($row, $startcol2);
2002:                 if ($key2 !== null) {
2003:                     $obj2 = CurrencyPeer::getInstanceFromPool($key2);
2004:                     if (!$obj2) {
2005: 
2006:                         $cls = CurrencyPeer::getOMClass();
2007: 
2008:                     $obj2 = new $cls();
2009:                     $obj2->hydrate($row, $startcol2);
2010:                     CurrencyPeer::addInstanceToPool($obj2, $key2);
2011:                 } // if $obj2 already loaded
2012: 
2013:                 // Add the $obj1 (Order) to the collection in $obj2 (Currency)
2014:                 $obj2->addOrder($obj1);
2015: 
2016:             } // if joined row is not null
2017: 
2018:                 // Add objects for joined Customer rows
2019: 
2020:                 $key3 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol3);
2021:                 if ($key3 !== null) {
2022:                     $obj3 = CustomerPeer::getInstanceFromPool($key3);
2023:                     if (!$obj3) {
2024: 
2025:                         $cls = CustomerPeer::getOMClass();
2026: 
2027:                     $obj3 = new $cls();
2028:                     $obj3->hydrate($row, $startcol3);
2029:                     CustomerPeer::addInstanceToPool($obj3, $key3);
2030:                 } // if $obj3 already loaded
2031: 
2032:                 // Add the $obj1 (Order) to the collection in $obj3 (Customer)
2033:                 $obj3->addOrder($obj1);
2034: 
2035:             } // if joined row is not null
2036: 
2037:                 // Add objects for joined OrderStatus rows
2038: 
2039:                 $key4 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol4);
2040:                 if ($key4 !== null) {
2041:                     $obj4 = OrderStatusPeer::getInstanceFromPool($key4);
2042:                     if (!$obj4) {
2043: 
2044:                         $cls = OrderStatusPeer::getOMClass();
2045: 
2046:                     $obj4 = new $cls();
2047:                     $obj4->hydrate($row, $startcol4);
2048:                     OrderStatusPeer::addInstanceToPool($obj4, $key4);
2049:                 } // if $obj4 already loaded
2050: 
2051:                 // Add the $obj1 (Order) to the collection in $obj4 (OrderStatus)
2052:                 $obj4->addOrder($obj1);
2053: 
2054:             } // if joined row is not null
2055: 
2056:             $results[] = $obj1;
2057:         }
2058:         $stmt->closeCursor();
2059: 
2060:         return $results;
2061:     }
2062: 
2063: 
2064:     /**
2065:      * Selects a collection of Order objects pre-filled with all related objects except OrderAddressRelatedByAddressDelivery.
2066:      *
2067:      * @param      Criteria  $criteria
2068:      * @param      PropelPDO $con
2069:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
2070:      * @return array           Array of Order objects.
2071:      * @throws PropelException Any exceptions caught during processing will be
2072:      *       rethrown wrapped into a PropelException.
2073:      */
2074:     public static function doSelectJoinAllExceptOrderAddressRelatedByAddressDelivery(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2075:     {
2076:         $criteria = clone $criteria;
2077: 
2078:         // Set the correct dbName if it has not been overridden
2079:         // $criteria->getDbName() will return the same object if not set to another value
2080:         // so == check is okay and faster
2081:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
2082:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
2083:         }
2084: 
2085:         OrderPeer::addSelectColumns($criteria);
2086:         $startcol2 = OrderPeer::NUM_HYDRATE_COLUMNS;
2087: 
2088:         CurrencyPeer::addSelectColumns($criteria);
2089:         $startcol3 = $startcol2 + CurrencyPeer::NUM_HYDRATE_COLUMNS;
2090: 
2091:         CustomerPeer::addSelectColumns($criteria);
2092:         $startcol4 = $startcol3 + CustomerPeer::NUM_HYDRATE_COLUMNS;
2093: 
2094:         OrderStatusPeer::addSelectColumns($criteria);
2095:         $startcol5 = $startcol4 + OrderStatusPeer::NUM_HYDRATE_COLUMNS;
2096: 
2097:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
2098: 
2099:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
2100: 
2101:         $criteria->addJoin(OrderPeer::STATUS_ID, OrderStatusPeer::ID, $join_behavior);
2102: 
2103: 
2104:         $stmt = BasePeer::doSelect($criteria, $con);
2105:         $results = array();
2106: 
2107:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
2108:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
2109:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
2110:                 // We no longer rehydrate the object, since this can cause data loss.
2111:                 // See http://www.propelorm.org/ticket/509
2112:                 // $obj1->hydrate($row, 0, true); // rehydrate
2113:             } else {
2114:                 $cls = OrderPeer::getOMClass();
2115: 
2116:                 $obj1 = new $cls();
2117:                 $obj1->hydrate($row);
2118:                 OrderPeer::addInstanceToPool($obj1, $key1);
2119:             } // if obj1 already loaded
2120: 
2121:                 // Add objects for joined Currency rows
2122: 
2123:                 $key2 = CurrencyPeer::getPrimaryKeyHashFromRow($row, $startcol2);
2124:                 if ($key2 !== null) {
2125:                     $obj2 = CurrencyPeer::getInstanceFromPool($key2);
2126:                     if (!$obj2) {
2127: 
2128:                         $cls = CurrencyPeer::getOMClass();
2129: 
2130:                     $obj2 = new $cls();
2131:                     $obj2->hydrate($row, $startcol2);
2132:                     CurrencyPeer::addInstanceToPool($obj2, $key2);
2133:                 } // if $obj2 already loaded
2134: 
2135:                 // Add the $obj1 (Order) to the collection in $obj2 (Currency)
2136:                 $obj2->addOrder($obj1);
2137: 
2138:             } // if joined row is not null
2139: 
2140:                 // Add objects for joined Customer rows
2141: 
2142:                 $key3 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol3);
2143:                 if ($key3 !== null) {
2144:                     $obj3 = CustomerPeer::getInstanceFromPool($key3);
2145:                     if (!$obj3) {
2146: 
2147:                         $cls = CustomerPeer::getOMClass();
2148: 
2149:                     $obj3 = new $cls();
2150:                     $obj3->hydrate($row, $startcol3);
2151:                     CustomerPeer::addInstanceToPool($obj3, $key3);
2152:                 } // if $obj3 already loaded
2153: 
2154:                 // Add the $obj1 (Order) to the collection in $obj3 (Customer)
2155:                 $obj3->addOrder($obj1);
2156: 
2157:             } // if joined row is not null
2158: 
2159:                 // Add objects for joined OrderStatus rows
2160: 
2161:                 $key4 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol4);
2162:                 if ($key4 !== null) {
2163:                     $obj4 = OrderStatusPeer::getInstanceFromPool($key4);
2164:                     if (!$obj4) {
2165: 
2166:                         $cls = OrderStatusPeer::getOMClass();
2167: 
2168:                     $obj4 = new $cls();
2169:                     $obj4->hydrate($row, $startcol4);
2170:                     OrderStatusPeer::addInstanceToPool($obj4, $key4);
2171:                 } // if $obj4 already loaded
2172: 
2173:                 // Add the $obj1 (Order) to the collection in $obj4 (OrderStatus)
2174:                 $obj4->addOrder($obj1);
2175: 
2176:             } // if joined row is not null
2177: 
2178:             $results[] = $obj1;
2179:         }
2180:         $stmt->closeCursor();
2181: 
2182:         return $results;
2183:     }
2184: 
2185: 
2186:     /**
2187:      * Selects a collection of Order objects pre-filled with all related objects except OrderStatus.
2188:      *
2189:      * @param      Criteria  $criteria
2190:      * @param      PropelPDO $con
2191:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
2192:      * @return array           Array of Order objects.
2193:      * @throws PropelException Any exceptions caught during processing will be
2194:      *       rethrown wrapped into a PropelException.
2195:      */
2196:     public static function doSelectJoinAllExceptOrderStatus(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2197:     {
2198:         $criteria = clone $criteria;
2199: 
2200:         // Set the correct dbName if it has not been overridden
2201:         // $criteria->getDbName() will return the same object if not set to another value
2202:         // so == check is okay and faster
2203:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
2204:             $criteria->setDbName(OrderPeer::DATABASE_NAME);
2205:         }
2206: 
2207:         OrderPeer::addSelectColumns($criteria);
2208:         $startcol2 = OrderPeer::NUM_HYDRATE_COLUMNS;
2209: 
2210:         CurrencyPeer::addSelectColumns($criteria);
2211:         $startcol3 = $startcol2 + CurrencyPeer::NUM_HYDRATE_COLUMNS;
2212: 
2213:         CustomerPeer::addSelectColumns($criteria);
2214:         $startcol4 = $startcol3 + CustomerPeer::NUM_HYDRATE_COLUMNS;
2215: 
2216:         OrderAddressPeer::addSelectColumns($criteria);
2217:         $startcol5 = $startcol4 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
2218: 
2219:         OrderAddressPeer::addSelectColumns($criteria);
2220:         $startcol6 = $startcol5 + OrderAddressPeer::NUM_HYDRATE_COLUMNS;
2221: 
2222:         $criteria->addJoin(OrderPeer::CURRENCY_ID, CurrencyPeer::ID, $join_behavior);
2223: 
2224:         $criteria->addJoin(OrderPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
2225: 
2226:         $criteria->addJoin(OrderPeer::ADDRESS_INVOICE, OrderAddressPeer::ID, $join_behavior);
2227: 
2228:         $criteria->addJoin(OrderPeer::ADDRESS_DELIVERY, OrderAddressPeer::ID, $join_behavior);
2229: 
2230: 
2231:         $stmt = BasePeer::doSelect($criteria, $con);
2232:         $results = array();
2233: 
2234:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
2235:             $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0);
2236:             if (null !== ($obj1 = OrderPeer::getInstanceFromPool($key1))) {
2237:                 // We no longer rehydrate the object, since this can cause data loss.
2238:                 // See http://www.propelorm.org/ticket/509
2239:                 // $obj1->hydrate($row, 0, true); // rehydrate
2240:             } else {
2241:                 $cls = OrderPeer::getOMClass();
2242: 
2243:                 $obj1 = new $cls();
2244:                 $obj1->hydrate($row);
2245:                 OrderPeer::addInstanceToPool($obj1, $key1);
2246:             } // if obj1 already loaded
2247: 
2248:                 // Add objects for joined Currency rows
2249: 
2250:                 $key2 = CurrencyPeer::getPrimaryKeyHashFromRow($row, $startcol2);
2251:                 if ($key2 !== null) {
2252:                     $obj2 = CurrencyPeer::getInstanceFromPool($key2);
2253:                     if (!$obj2) {
2254: 
2255:                         $cls = CurrencyPeer::getOMClass();
2256: 
2257:                     $obj2 = new $cls();
2258:                     $obj2->hydrate($row, $startcol2);
2259:                     CurrencyPeer::addInstanceToPool($obj2, $key2);
2260:                 } // if $obj2 already loaded
2261: 
2262:                 // Add the $obj1 (Order) to the collection in $obj2 (Currency)
2263:                 $obj2->addOrder($obj1);
2264: 
2265:             } // if joined row is not null
2266: 
2267:                 // Add objects for joined Customer rows
2268: 
2269:                 $key3 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol3);
2270:                 if ($key3 !== null) {
2271:                     $obj3 = CustomerPeer::getInstanceFromPool($key3);
2272:                     if (!$obj3) {
2273: 
2274:                         $cls = CustomerPeer::getOMClass();
2275: 
2276:                     $obj3 = new $cls();
2277:                     $obj3->hydrate($row, $startcol3);
2278:                     CustomerPeer::addInstanceToPool($obj3, $key3);
2279:                 } // if $obj3 already loaded
2280: 
2281:                 // Add the $obj1 (Order) to the collection in $obj3 (Customer)
2282:                 $obj3->addOrder($obj1);
2283: 
2284:             } // if joined row is not null
2285: 
2286:                 // Add objects for joined OrderAddress rows
2287: 
2288:                 $key4 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol4);
2289:                 if ($key4 !== null) {
2290:                     $obj4 = OrderAddressPeer::getInstanceFromPool($key4);
2291:                     if (!$obj4) {
2292: 
2293:                         $cls = OrderAddressPeer::getOMClass();
2294: 
2295:                     $obj4 = new $cls();
2296:                     $obj4->hydrate($row, $startcol4);
2297:                     OrderAddressPeer::addInstanceToPool($obj4, $key4);
2298:                 } // if $obj4 already loaded
2299: 
2300:                 // Add the $obj1 (Order) to the collection in $obj4 (OrderAddress)
2301:                 $obj4->addOrderRelatedByAddressInvoice($obj1);
2302: 
2303:             } // if joined row is not null
2304: 
2305:                 // Add objects for joined OrderAddress rows
2306: 
2307:                 $key5 = OrderAddressPeer::getPrimaryKeyHashFromRow($row, $startcol5);
2308:                 if ($key5 !== null) {
2309:                     $obj5 = OrderAddressPeer::getInstanceFromPool($key5);
2310:                     if (!$obj5) {
2311: 
2312:                         $cls = OrderAddressPeer::getOMClass();
2313: 
2314:                     $obj5 = new $cls();
2315:                     $obj5->hydrate($row, $startcol5);
2316:                     OrderAddressPeer::addInstanceToPool($obj5, $key5);
2317:                 } // if $obj5 already loaded
2318: 
2319:                 // Add the $obj1 (Order) to the collection in $obj5 (OrderAddress)
2320:                 $obj5->addOrderRelatedByAddressDelivery($obj1);
2321: 
2322:             } // if joined row is not null
2323: 
2324:             $results[] = $obj1;
2325:         }
2326:         $stmt->closeCursor();
2327: 
2328:         return $results;
2329:     }
2330: 
2331:     /**
2332:      * Returns the TableMap related to this peer.
2333:      * This method is not needed for general use but a specific application could have a need.
2334:      * @return TableMap
2335:      * @throws PropelException Any exceptions caught during processing will be
2336:      *       rethrown wrapped into a PropelException.
2337:      */
2338:     public static function getTableMap()
2339:     {
2340:         return Propel::getDatabaseMap(OrderPeer::DATABASE_NAME)->getTable(OrderPeer::TABLE_NAME);
2341:     }
2342: 
2343:     /**
2344:      * Add a TableMap instance to the database for this peer class.
2345:      */
2346:     public static function buildTableMap()
2347:     {
2348:       $dbMap = Propel::getDatabaseMap(BaseOrderPeer::DATABASE_NAME);
2349:       if (!$dbMap->hasTable(BaseOrderPeer::TABLE_NAME)) {
2350:         $dbMap->addTableObject(new OrderTableMap());
2351:       }
2352:     }
2353: 
2354:     /**
2355:      * The class that the Peer will make instances of.
2356:      *
2357:      *
2358:      * @return string ClassName
2359:      */
2360:     public static function getOMClass()
2361:     {
2362:         return OrderPeer::OM_CLASS;
2363:     }
2364: 
2365:     /**
2366:      * Performs an INSERT on the database, given a Order or Criteria object.
2367:      *
2368:      * @param      mixed $values Criteria or Order object containing data that is used to create the INSERT statement.
2369:      * @param      PropelPDO $con the PropelPDO connection to use
2370:      * @return mixed           The new primary key.
2371:      * @throws PropelException Any exceptions caught during processing will be
2372:      *       rethrown wrapped into a PropelException.
2373:      */
2374:     public static function doInsert($values, PropelPDO $con = null)
2375:     {
2376:         if ($con === null) {
2377:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
2378:         }
2379: 
2380:         if ($values instanceof Criteria) {
2381:             $criteria = clone $values; // rename for clarity
2382:         } else {
2383:             $criteria = $values->buildCriteria(); // build Criteria from Order object
2384:         }
2385: 
2386:         if ($criteria->containsKey(OrderPeer::ID) && $criteria->keyContainsValue(OrderPeer::ID) ) {
2387:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderPeer::ID.')');
2388:         }
2389: 
2390: 
2391:         // Set the correct dbName
2392:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
2393: 
2394:         try {
2395:             // use transaction because $criteria could contain info
2396:             // for more than one table (I guess, conceivably)
2397:             $con->beginTransaction();
2398:             $pk = BasePeer::doInsert($criteria, $con);
2399:             $con->commit();
2400:         } catch (PropelException $e) {
2401:             $con->rollBack();
2402:             throw $e;
2403:         }
2404: 
2405:         return $pk;
2406:     }
2407: 
2408:     /**
2409:      * Performs an UPDATE on the database, given a Order or Criteria object.
2410:      *
2411:      * @param      mixed $values Criteria or Order object containing data that is used to create the UPDATE statement.
2412:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
2413:      * @return int             The number of affected rows (if supported by underlying database driver).
2414:      * @throws PropelException Any exceptions caught during processing will be
2415:      *       rethrown wrapped into a PropelException.
2416:      */
2417:     public static function doUpdate($values, PropelPDO $con = null)
2418:     {
2419:         if ($con === null) {
2420:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
2421:         }
2422: 
2423:         $selectCriteria = new Criteria(OrderPeer::DATABASE_NAME);
2424: 
2425:         if ($values instanceof Criteria) {
2426:             $criteria = clone $values; // rename for clarity
2427: 
2428:             $comparison = $criteria->getComparison(OrderPeer::ID);
2429:             $value = $criteria->remove(OrderPeer::ID);
2430:             if ($value) {
2431:                 $selectCriteria->add(OrderPeer::ID, $value, $comparison);
2432:             } else {
2433:                 $selectCriteria->setPrimaryTableName(OrderPeer::TABLE_NAME);
2434:             }
2435: 
2436:         } else { // $values is Order object
2437:             $criteria = $values->buildCriteria(); // gets full criteria
2438:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
2439:         }
2440: 
2441:         // set the correct dbName
2442:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
2443: 
2444:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
2445:     }
2446: 
2447:     /**
2448:      * Deletes all rows from the order table.
2449:      *
2450:      * @param      PropelPDO $con the connection to use
2451:      * @return int             The number of affected rows (if supported by underlying database driver).
2452:      * @throws PropelException
2453:      */
2454:     public static function doDeleteAll(PropelPDO $con = null)
2455:     {
2456:         if ($con === null) {
2457:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
2458:         }
2459:         $affectedRows = 0; // initialize var to track total num of affected rows
2460:         try {
2461:             // use transaction because $criteria could contain info
2462:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
2463:             $con->beginTransaction();
2464:             $affectedRows += BasePeer::doDeleteAll(OrderPeer::TABLE_NAME, $con, OrderPeer::DATABASE_NAME);
2465:             // Because this db requires some delete cascade/set null emulation, we have to
2466:             // clear the cached instance *after* the emulation has happened (since
2467:             // instances get re-added by the select statement contained therein).
2468:             OrderPeer::clearInstancePool();
2469:             OrderPeer::clearRelatedInstancePool();
2470:             $con->commit();
2471: 
2472:             return $affectedRows;
2473:         } catch (PropelException $e) {
2474:             $con->rollBack();
2475:             throw $e;
2476:         }
2477:     }
2478: 
2479:     /**
2480:      * Performs a DELETE on the database, given a Order or Criteria object OR a primary key value.
2481:      *
2482:      * @param      mixed $values Criteria or Order object or primary key or array of primary keys
2483:      *              which is used to create the DELETE statement
2484:      * @param      PropelPDO $con the connection to use
2485:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
2486:      *              if supported by native driver or if emulated using Propel.
2487:      * @throws PropelException Any exceptions caught during processing will be
2488:      *       rethrown wrapped into a PropelException.
2489:      */
2490:      public static function doDelete($values, PropelPDO $con = null)
2491:      {
2492:         if ($con === null) {
2493:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
2494:         }
2495: 
2496:         if ($values instanceof Criteria) {
2497:             // invalidate the cache for all objects of this type, since we have no
2498:             // way of knowing (without running a query) what objects should be invalidated
2499:             // from the cache based on this Criteria.
2500:             OrderPeer::clearInstancePool();
2501:             // rename for clarity
2502:             $criteria = clone $values;
2503:         } elseif ($values instanceof Order) { // it's a model object
2504:             // invalidate the cache for this single object
2505:             OrderPeer::removeInstanceFromPool($values);
2506:             // create criteria based on pk values
2507:             $criteria = $values->buildPkeyCriteria();
2508:         } else { // it's a primary key, or an array of pks
2509:             $criteria = new Criteria(OrderPeer::DATABASE_NAME);
2510:             $criteria->add(OrderPeer::ID, (array) $values, Criteria::IN);
2511:             // invalidate the cache for this object(s)
2512:             foreach ((array) $values as $singleval) {
2513:                 OrderPeer::removeInstanceFromPool($singleval);
2514:             }
2515:         }
2516: 
2517:         // Set the correct dbName
2518:         $criteria->setDbName(OrderPeer::DATABASE_NAME);
2519: 
2520:         $affectedRows = 0; // initialize var to track total num of affected rows
2521: 
2522:         try {
2523:             // use transaction because $criteria could contain info
2524:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
2525:             $con->beginTransaction();
2526: 
2527:             $affectedRows += BasePeer::doDelete($criteria, $con);
2528:             OrderPeer::clearRelatedInstancePool();
2529:             $con->commit();
2530: 
2531:             return $affectedRows;
2532:         } catch (PropelException $e) {
2533:             $con->rollBack();
2534:             throw $e;
2535:         }
2536:     }
2537: 
2538:     /**
2539:      * Validates all modified columns of given Order object.
2540:      * If parameter $columns is either a single column name or an array of column names
2541:      * than only those columns are validated.
2542:      *
2543:      * NOTICE: This does not apply to primary or foreign keys for now.
2544:      *
2545:      * @param      Order $obj The object to validate.
2546:      * @param      mixed $cols Column name or array of column names.
2547:      *
2548:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
2549:      */
2550:     public static function doValidate($obj, $cols = null)
2551:     {
2552:         $columns = array();
2553: 
2554:         if ($cols) {
2555:             $dbMap = Propel::getDatabaseMap(OrderPeer::DATABASE_NAME);
2556:             $tableMap = $dbMap->getTable(OrderPeer::TABLE_NAME);
2557: 
2558:             if (! is_array($cols)) {
2559:                 $cols = array($cols);
2560:             }
2561: 
2562:             foreach ($cols as $colName) {
2563:                 if ($tableMap->hasColumn($colName)) {
2564:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
2565:                     $columns[$colName] = $obj->$get();
2566:                 }
2567:             }
2568:         } else {
2569: 
2570:         }
2571: 
2572:         return BasePeer::doValidate(OrderPeer::DATABASE_NAME, OrderPeer::TABLE_NAME, $columns);
2573:     }
2574: 
2575:     /**
2576:      * Retrieve a single object by pkey.
2577:      *
2578:      * @param      int $pk the primary key.
2579:      * @param      PropelPDO $con the connection to use
2580:      * @return Order
2581:      */
2582:     public static function retrieveByPK($pk, PropelPDO $con = null)
2583:     {
2584: 
2585:         if (null !== ($obj = OrderPeer::getInstanceFromPool((string) $pk))) {
2586:             return $obj;
2587:         }
2588: 
2589:         if ($con === null) {
2590:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
2591:         }
2592: 
2593:         $criteria = new Criteria(OrderPeer::DATABASE_NAME);
2594:         $criteria->add(OrderPeer::ID, $pk);
2595: 
2596:         $v = OrderPeer::doSelect($criteria, $con);
2597: 
2598:         return !empty($v) > 0 ? $v[0] : null;
2599:     }
2600: 
2601:     /**
2602:      * Retrieve multiple objects by pkey.
2603:      *
2604:      * @param      array $pks List of primary keys
2605:      * @param      PropelPDO $con the connection to use
2606:      * @return Order[]
2607:      * @throws PropelException Any exceptions caught during processing will be
2608:      *       rethrown wrapped into a PropelException.
2609:      */
2610:     public static function retrieveByPKs($pks, PropelPDO $con = null)
2611:     {
2612:         if ($con === null) {
2613:             $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
2614:         }
2615: 
2616:         $objs = null;
2617:         if (empty($pks)) {
2618:             $objs = array();
2619:         } else {
2620:             $criteria = new Criteria(OrderPeer::DATABASE_NAME);
2621:             $criteria->add(OrderPeer::ID, $pks, Criteria::IN);
2622:             $objs = OrderPeer::doSelect($criteria, $con);
2623:         }
2624: 
2625:         return $objs;
2626:     }
2627: 
2628: } // BaseOrderPeer
2629: 
2630: // This is the static code needed to register the TableMap for this table with the main Propel class.
2631: //
2632: BaseOrderPeer::buildTableMap();
2633: 
2634: 
thelia API documentation generated by ApiGen 2.8.0