Overview

Namespaces

  • Thelia
    • Action
    • Config
    • Controller
    • Core
      • Bundle
      • DependencyInjection
        • Compiler
        • Loader
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Element
        • Loop
        • TestLoop
      • Event
      • Exception
      • Filter
      • Tokenizer

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModule
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseModuleQuery
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • 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\ProductPeer;
 13: use Thelia\Model\TaxRule;
 14: use Thelia\Model\TaxRuleCountryPeer;
 15: use Thelia\Model\TaxRuleI18nPeer;
 16: use Thelia\Model\TaxRulePeer;
 17: use Thelia\Model\map\TaxRuleTableMap;
 18: 
 19: /**
 20:  * Base static class for performing query and update operations on the 'tax_rule' table.
 21:  *
 22:  *
 23:  *
 24:  * @package propel.generator.Thelia.Model.om
 25:  */
 26: abstract class BaseTaxRulePeer
 27: {
 28: 
 29:     /** the default database name for this class */
 30:     const DATABASE_NAME = 'thelia';
 31: 
 32:     /** the table name for this class */
 33:     const TABLE_NAME = 'tax_rule';
 34: 
 35:     /** the related Propel class for this table */
 36:     const OM_CLASS = 'Thelia\\Model\\TaxRule';
 37: 
 38:     /** the related TableMap class for this table */
 39:     const TM_CLASS = 'TaxRuleTableMap';
 40: 
 41:     /** The total number of columns. */
 42:     const NUM_COLUMNS = 6;
 43: 
 44:     /** The number of lazy-loaded columns. */
 45:     const NUM_LAZY_LOAD_COLUMNS = 0;
 46: 
 47:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
 48:     const NUM_HYDRATE_COLUMNS = 6;
 49: 
 50:     /** the column name for the id field */
 51:     const ID = 'tax_rule.id';
 52: 
 53:     /** the column name for the code field */
 54:     const CODE = 'tax_rule.code';
 55: 
 56:     /** the column name for the title field */
 57:     const TITLE = 'tax_rule.title';
 58: 
 59:     /** the column name for the description field */
 60:     const DESCRIPTION = 'tax_rule.description';
 61: 
 62:     /** the column name for the created_at field */
 63:     const CREATED_AT = 'tax_rule.created_at';
 64: 
 65:     /** the column name for the updated_at field */
 66:     const UPDATED_AT = 'tax_rule.updated_at';
 67: 
 68:     /** The default string format for model objects of the related table **/
 69:     const DEFAULT_STRING_FORMAT = 'YAML';
 70: 
 71:     /**
 72:      * An identiy map to hold any loaded instances of TaxRule objects.
 73:      * This must be public so that other peer classes can access this when hydrating from JOIN
 74:      * queries.
 75:      * @var        array TaxRule[]
 76:      */
 77:     public static $instances = array();
 78: 
 79: 
 80:     // i18n behavior
 81: 
 82:     /**
 83:      * The default locale to use for translations
 84:      * @var        string
 85:      */
 86:     const DEFAULT_LOCALE = 'en_US';
 87:     /**
 88:      * holds an array of fieldnames
 89:      *
 90:      * first dimension keys are the type constants
 91:      * e.g. TaxRulePeer::$fieldNames[TaxRulePeer::TYPE_PHPNAME][0] = 'Id'
 92:      */
 93:     protected static $fieldNames = array (
 94:         BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Title', 'Description', 'CreatedAt', 'UpdatedAt', ),
 95:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'title', 'description', 'createdAt', 'updatedAt', ),
 96:         BasePeer::TYPE_COLNAME => array (TaxRulePeer::ID, TaxRulePeer::CODE, TaxRulePeer::TITLE, TaxRulePeer::DESCRIPTION, TaxRulePeer::CREATED_AT, TaxRulePeer::UPDATED_AT, ),
 97:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'TITLE', 'DESCRIPTION', 'CREATED_AT', 'UPDATED_AT', ),
 98:         BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'title', 'description', 'created_at', 'updated_at', ),
 99:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
100:     );
101: 
102:     /**
103:      * holds an array of keys for quick access to the fieldnames array
104:      *
105:      * first dimension keys are the type constants
106:      * e.g. TaxRulePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
107:      */
108:     protected static $fieldKeys = array (
109:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Title' => 2, 'Description' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
110:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
111:         BasePeer::TYPE_COLNAME => array (TaxRulePeer::ID => 0, TaxRulePeer::CODE => 1, TaxRulePeer::TITLE => 2, TaxRulePeer::DESCRIPTION => 3, TaxRulePeer::CREATED_AT => 4, TaxRulePeer::UPDATED_AT => 5, ),
112:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
113:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'created_at' => 4, 'updated_at' => 5, ),
114:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
115:     );
116: 
117:     /**
118:      * Translates a fieldname to another type
119:      *
120:      * @param      string $name field name
121:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
122:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
123:      * @param      string $toType   One of the class type constants
124:      * @return string          translated name of the field.
125:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
126:      */
127:     public static function translateFieldName($name, $fromType, $toType)
128:     {
129:         $toNames = TaxRulePeer::getFieldNames($toType);
130:         $key = isset(TaxRulePeer::$fieldKeys[$fromType][$name]) ? TaxRulePeer::$fieldKeys[$fromType][$name] : null;
131:         if ($key === null) {
132:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(TaxRulePeer::$fieldKeys[$fromType], true));
133:         }
134: 
135:         return $toNames[$key];
136:     }
137: 
138:     /**
139:      * Returns an array of field names.
140:      *
141:      * @param      string $type The type of fieldnames to return:
142:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
143:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
144:      * @return array           A list of field names
145:      * @throws PropelException - if the type is not valid.
146:      */
147:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
148:     {
149:         if (!array_key_exists($type, TaxRulePeer::$fieldNames)) {
150:             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.');
151:         }
152: 
153:         return TaxRulePeer::$fieldNames[$type];
154:     }
155: 
156:     /**
157:      * Convenience method which changes table.column to alias.column.
158:      *
159:      * Using this method you can maintain SQL abstraction while using column aliases.
160:      * <code>
161:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
162:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
163:      * </code>
164:      * @param      string $alias The alias for the current table.
165:      * @param      string $column The column name for current table. (i.e. TaxRulePeer::COLUMN_NAME).
166:      * @return string
167:      */
168:     public static function alias($alias, $column)
169:     {
170:         return str_replace(TaxRulePeer::TABLE_NAME.'.', $alias.'.', $column);
171:     }
172: 
173:     /**
174:      * Add all the columns needed to create a new object.
175:      *
176:      * Note: any columns that were marked with lazyLoad="true" in the
177:      * XML schema will not be added to the select list and only loaded
178:      * on demand.
179:      *
180:      * @param      Criteria $criteria object containing the columns to add.
181:      * @param      string   $alias    optional table alias
182:      * @throws PropelException Any exceptions caught during processing will be
183:      *       rethrown wrapped into a PropelException.
184:      */
185:     public static function addSelectColumns(Criteria $criteria, $alias = null)
186:     {
187:         if (null === $alias) {
188:             $criteria->addSelectColumn(TaxRulePeer::ID);
189:             $criteria->addSelectColumn(TaxRulePeer::CODE);
190:             $criteria->addSelectColumn(TaxRulePeer::TITLE);
191:             $criteria->addSelectColumn(TaxRulePeer::DESCRIPTION);
192:             $criteria->addSelectColumn(TaxRulePeer::CREATED_AT);
193:             $criteria->addSelectColumn(TaxRulePeer::UPDATED_AT);
194:         } else {
195:             $criteria->addSelectColumn($alias . '.id');
196:             $criteria->addSelectColumn($alias . '.code');
197:             $criteria->addSelectColumn($alias . '.title');
198:             $criteria->addSelectColumn($alias . '.description');
199:             $criteria->addSelectColumn($alias . '.created_at');
200:             $criteria->addSelectColumn($alias . '.updated_at');
201:         }
202:     }
203: 
204:     /**
205:      * Returns the number of rows matching criteria.
206:      *
207:      * @param      Criteria $criteria
208:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
209:      * @param      PropelPDO $con
210:      * @return int Number of matching rows.
211:      */
212:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
213:     {
214:         // we may modify criteria, so copy it first
215:         $criteria = clone $criteria;
216: 
217:         // We need to set the primary table name, since in the case that there are no WHERE columns
218:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
219:         // tables go into the FROM clause.
220:         $criteria->setPrimaryTableName(TaxRulePeer::TABLE_NAME);
221: 
222:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
223:             $criteria->setDistinct();
224:         }
225: 
226:         if (!$criteria->hasSelectClause()) {
227:             TaxRulePeer::addSelectColumns($criteria);
228:         }
229: 
230:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
231:         $criteria->setDbName(TaxRulePeer::DATABASE_NAME); // Set the correct dbName
232: 
233:         if ($con === null) {
234:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
235:         }
236:         // BasePeer returns a PDOStatement
237:         $stmt = BasePeer::doCount($criteria, $con);
238: 
239:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
240:             $count = (int) $row[0];
241:         } else {
242:             $count = 0; // no rows returned; we infer that means 0 matches.
243:         }
244:         $stmt->closeCursor();
245: 
246:         return $count;
247:     }
248:     /**
249:      * Selects one object from the DB.
250:      *
251:      * @param      Criteria $criteria object used to create the SELECT statement.
252:      * @param      PropelPDO $con
253:      * @return                 TaxRule
254:      * @throws PropelException Any exceptions caught during processing will be
255:      *       rethrown wrapped into a PropelException.
256:      */
257:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
258:     {
259:         $critcopy = clone $criteria;
260:         $critcopy->setLimit(1);
261:         $objects = TaxRulePeer::doSelect($critcopy, $con);
262:         if ($objects) {
263:             return $objects[0];
264:         }
265: 
266:         return null;
267:     }
268:     /**
269:      * Selects several row from the DB.
270:      *
271:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
272:      * @param      PropelPDO $con
273:      * @return array           Array of selected Objects
274:      * @throws PropelException Any exceptions caught during processing will be
275:      *       rethrown wrapped into a PropelException.
276:      */
277:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
278:     {
279:         return TaxRulePeer::populateObjects(TaxRulePeer::doSelectStmt($criteria, $con));
280:     }
281:     /**
282:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
283:      *
284:      * Use this method directly if you want to work with an executed statement directly (for example
285:      * to perform your own object hydration).
286:      *
287:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
288:      * @param      PropelPDO $con The connection to use
289:      * @throws PropelException Any exceptions caught during processing will be
290:      *       rethrown wrapped into a PropelException.
291:      * @return PDOStatement The executed PDOStatement object.
292:      * @see        BasePeer::doSelect()
293:      */
294:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
295:     {
296:         if ($con === null) {
297:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
298:         }
299: 
300:         if (!$criteria->hasSelectClause()) {
301:             $criteria = clone $criteria;
302:             TaxRulePeer::addSelectColumns($criteria);
303:         }
304: 
305:         // Set the correct dbName
306:         $criteria->setDbName(TaxRulePeer::DATABASE_NAME);
307: 
308:         // BasePeer returns a PDOStatement
309:         return BasePeer::doSelect($criteria, $con);
310:     }
311:     /**
312:      * Adds an object to the instance pool.
313:      *
314:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
315:      * from the database.  In some cases -- especially when you override doSelect*()
316:      * methods in your stub classes -- you may need to explicitly add objects
317:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
318:      * and retrieveByPK*() calls.
319:      *
320:      * @param      TaxRule $obj A TaxRule object.
321:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
322:      */
323:     public static function addInstanceToPool($obj, $key = null)
324:     {
325:         if (Propel::isInstancePoolingEnabled()) {
326:             if ($key === null) {
327:                 $key = (string) $obj->getId();
328:             } // if key === null
329:             TaxRulePeer::$instances[$key] = $obj;
330:         }
331:     }
332: 
333:     /**
334:      * Removes an object from the instance pool.
335:      *
336:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
337:      * from the database.  In some cases -- especially when you override doDelete
338:      * methods in your stub classes -- you may need to explicitly remove objects
339:      * from the cache in order to prevent returning objects that no longer exist.
340:      *
341:      * @param      mixed $value A TaxRule object or a primary key value.
342:      *
343:      * @return void
344:      * @throws PropelException - if the value is invalid.
345:      */
346:     public static function removeInstanceFromPool($value)
347:     {
348:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
349:             if (is_object($value) && $value instanceof TaxRule) {
350:                 $key = (string) $value->getId();
351:             } elseif (is_scalar($value)) {
352:                 // assume we've been passed a primary key
353:                 $key = (string) $value;
354:             } else {
355:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or TaxRule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
356:                 throw $e;
357:             }
358: 
359:             unset(TaxRulePeer::$instances[$key]);
360:         }
361:     } // removeInstanceFromPool()
362: 
363:     /**
364:      * 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.
365:      *
366:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
367:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
368:      *
369:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
370:      * @return   TaxRule Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
371:      * @see        getPrimaryKeyHash()
372:      */
373:     public static function getInstanceFromPool($key)
374:     {
375:         if (Propel::isInstancePoolingEnabled()) {
376:             if (isset(TaxRulePeer::$instances[$key])) {
377:                 return TaxRulePeer::$instances[$key];
378:             }
379:         }
380: 
381:         return null; // just to be explicit
382:     }
383: 
384:     /**
385:      * Clear the instance pool.
386:      *
387:      * @return void
388:      */
389:     public static function clearInstancePool($and_clear_all_references = false)
390:     {
391:       if ($and_clear_all_references)
392:       {
393:         foreach (TaxRulePeer::$instances as $instance)
394:         {
395:           $instance->clearAllReferences(true);
396:         }
397:       }
398:         TaxRulePeer::$instances = array();
399:     }
400: 
401:     /**
402:      * Method to invalidate the instance pool of all tables related to tax_rule
403:      * by a foreign key with ON DELETE CASCADE
404:      */
405:     public static function clearRelatedInstancePool()
406:     {
407:         // Invalidate objects in ProductPeer instance pool,
408:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
409:         ProductPeer::clearInstancePool();
410:         // Invalidate objects in TaxRuleCountryPeer instance pool,
411:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
412:         TaxRuleCountryPeer::clearInstancePool();
413:         // Invalidate objects in TaxRuleI18nPeer instance pool,
414:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
415:         TaxRuleI18nPeer::clearInstancePool();
416:     }
417: 
418:     /**
419:      * 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.
420:      *
421:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
422:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
423:      *
424:      * @param      array $row PropelPDO resultset row.
425:      * @param      int $startcol The 0-based offset for reading from the resultset row.
426:      * @return string A string version of PK or null if the components of primary key in result array are all null.
427:      */
428:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
429:     {
430:         // If the PK cannot be derived from the row, return null.
431:         if ($row[$startcol] === null) {
432:             return null;
433:         }
434: 
435:         return (string) $row[$startcol];
436:     }
437: 
438:     /**
439:      * Retrieves the primary key from the DB resultset row
440:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
441:      * a multi-column primary key, an array of the primary key columns will be returned.
442:      *
443:      * @param      array $row PropelPDO resultset row.
444:      * @param      int $startcol The 0-based offset for reading from the resultset row.
445:      * @return mixed The primary key of the row
446:      */
447:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
448:     {
449: 
450:         return (int) $row[$startcol];
451:     }
452: 
453:     /**
454:      * The returned array will contain objects of the default type or
455:      * objects that inherit from the default.
456:      *
457:      * @throws PropelException Any exceptions caught during processing will be
458:      *       rethrown wrapped into a PropelException.
459:      */
460:     public static function populateObjects(PDOStatement $stmt)
461:     {
462:         $results = array();
463: 
464:         // set the class once to avoid overhead in the loop
465:         $cls = TaxRulePeer::getOMClass();
466:         // populate the object(s)
467:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
468:             $key = TaxRulePeer::getPrimaryKeyHashFromRow($row, 0);
469:             if (null !== ($obj = TaxRulePeer::getInstanceFromPool($key))) {
470:                 // We no longer rehydrate the object, since this can cause data loss.
471:                 // See http://www.propelorm.org/ticket/509
472:                 // $obj->hydrate($row, 0, true); // rehydrate
473:                 $results[] = $obj;
474:             } else {
475:                 $obj = new $cls();
476:                 $obj->hydrate($row);
477:                 $results[] = $obj;
478:                 TaxRulePeer::addInstanceToPool($obj, $key);
479:             } // if key exists
480:         }
481:         $stmt->closeCursor();
482: 
483:         return $results;
484:     }
485:     /**
486:      * Populates an object of the default type or an object that inherit from the default.
487:      *
488:      * @param      array $row PropelPDO resultset row.
489:      * @param      int $startcol The 0-based offset for reading from the resultset row.
490:      * @throws PropelException Any exceptions caught during processing will be
491:      *       rethrown wrapped into a PropelException.
492:      * @return array (TaxRule object, last column rank)
493:      */
494:     public static function populateObject($row, $startcol = 0)
495:     {
496:         $key = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol);
497:         if (null !== ($obj = TaxRulePeer::getInstanceFromPool($key))) {
498:             // We no longer rehydrate the object, since this can cause data loss.
499:             // See http://www.propelorm.org/ticket/509
500:             // $obj->hydrate($row, $startcol, true); // rehydrate
501:             $col = $startcol + TaxRulePeer::NUM_HYDRATE_COLUMNS;
502:         } else {
503:             $cls = TaxRulePeer::OM_CLASS;
504:             $obj = new $cls();
505:             $col = $obj->hydrate($row, $startcol);
506:             TaxRulePeer::addInstanceToPool($obj, $key);
507:         }
508: 
509:         return array($obj, $col);
510:     }
511: 
512:     /**
513:      * Returns the TableMap related to this peer.
514:      * This method is not needed for general use but a specific application could have a need.
515:      * @return TableMap
516:      * @throws PropelException Any exceptions caught during processing will be
517:      *       rethrown wrapped into a PropelException.
518:      */
519:     public static function getTableMap()
520:     {
521:         return Propel::getDatabaseMap(TaxRulePeer::DATABASE_NAME)->getTable(TaxRulePeer::TABLE_NAME);
522:     }
523: 
524:     /**
525:      * Add a TableMap instance to the database for this peer class.
526:      */
527:     public static function buildTableMap()
528:     {
529:       $dbMap = Propel::getDatabaseMap(BaseTaxRulePeer::DATABASE_NAME);
530:       if (!$dbMap->hasTable(BaseTaxRulePeer::TABLE_NAME)) {
531:         $dbMap->addTableObject(new TaxRuleTableMap());
532:       }
533:     }
534: 
535:     /**
536:      * The class that the Peer will make instances of.
537:      *
538:      *
539:      * @return string ClassName
540:      */
541:     public static function getOMClass($row = 0, $colnum = 0)
542:     {
543:         return TaxRulePeer::OM_CLASS;
544:     }
545: 
546:     /**
547:      * Performs an INSERT on the database, given a TaxRule or Criteria object.
548:      *
549:      * @param      mixed $values Criteria or TaxRule object containing data that is used to create the INSERT statement.
550:      * @param      PropelPDO $con the PropelPDO connection to use
551:      * @return mixed           The new primary key.
552:      * @throws PropelException Any exceptions caught during processing will be
553:      *       rethrown wrapped into a PropelException.
554:      */
555:     public static function doInsert($values, PropelPDO $con = null)
556:     {
557:         if ($con === null) {
558:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
559:         }
560: 
561:         if ($values instanceof Criteria) {
562:             $criteria = clone $values; // rename for clarity
563:         } else {
564:             $criteria = $values->buildCriteria(); // build Criteria from TaxRule object
565:         }
566: 
567:         if ($criteria->containsKey(TaxRulePeer::ID) && $criteria->keyContainsValue(TaxRulePeer::ID) ) {
568:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.TaxRulePeer::ID.')');
569:         }
570: 
571: 
572:         // Set the correct dbName
573:         $criteria->setDbName(TaxRulePeer::DATABASE_NAME);
574: 
575:         try {
576:             // use transaction because $criteria could contain info
577:             // for more than one table (I guess, conceivably)
578:             $con->beginTransaction();
579:             $pk = BasePeer::doInsert($criteria, $con);
580:             $con->commit();
581:         } catch (PropelException $e) {
582:             $con->rollBack();
583:             throw $e;
584:         }
585: 
586:         return $pk;
587:     }
588: 
589:     /**
590:      * Performs an UPDATE on the database, given a TaxRule or Criteria object.
591:      *
592:      * @param      mixed $values Criteria or TaxRule object containing data that is used to create the UPDATE statement.
593:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
594:      * @return int             The number of affected rows (if supported by underlying database driver).
595:      * @throws PropelException Any exceptions caught during processing will be
596:      *       rethrown wrapped into a PropelException.
597:      */
598:     public static function doUpdate($values, PropelPDO $con = null)
599:     {
600:         if ($con === null) {
601:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
602:         }
603: 
604:         $selectCriteria = new Criteria(TaxRulePeer::DATABASE_NAME);
605: 
606:         if ($values instanceof Criteria) {
607:             $criteria = clone $values; // rename for clarity
608: 
609:             $comparison = $criteria->getComparison(TaxRulePeer::ID);
610:             $value = $criteria->remove(TaxRulePeer::ID);
611:             if ($value) {
612:                 $selectCriteria->add(TaxRulePeer::ID, $value, $comparison);
613:             } else {
614:                 $selectCriteria->setPrimaryTableName(TaxRulePeer::TABLE_NAME);
615:             }
616: 
617:         } else { // $values is TaxRule object
618:             $criteria = $values->buildCriteria(); // gets full criteria
619:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
620:         }
621: 
622:         // set the correct dbName
623:         $criteria->setDbName(TaxRulePeer::DATABASE_NAME);
624: 
625:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
626:     }
627: 
628:     /**
629:      * Deletes all rows from the tax_rule table.
630:      *
631:      * @param      PropelPDO $con the connection to use
632:      * @return int             The number of affected rows (if supported by underlying database driver).
633:      * @throws PropelException
634:      */
635:     public static function doDeleteAll(PropelPDO $con = null)
636:     {
637:         if ($con === null) {
638:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
639:         }
640:         $affectedRows = 0; // initialize var to track total num of affected rows
641:         try {
642:             // use transaction because $criteria could contain info
643:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
644:             $con->beginTransaction();
645:             $affectedRows += BasePeer::doDeleteAll(TaxRulePeer::TABLE_NAME, $con, TaxRulePeer::DATABASE_NAME);
646:             // Because this db requires some delete cascade/set null emulation, we have to
647:             // clear the cached instance *after* the emulation has happened (since
648:             // instances get re-added by the select statement contained therein).
649:             TaxRulePeer::clearInstancePool();
650:             TaxRulePeer::clearRelatedInstancePool();
651:             $con->commit();
652: 
653:             return $affectedRows;
654:         } catch (PropelException $e) {
655:             $con->rollBack();
656:             throw $e;
657:         }
658:     }
659: 
660:     /**
661:      * Performs a DELETE on the database, given a TaxRule or Criteria object OR a primary key value.
662:      *
663:      * @param      mixed $values Criteria or TaxRule object or primary key or array of primary keys
664:      *              which is used to create the DELETE statement
665:      * @param      PropelPDO $con the connection to use
666:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
667:      *              if supported by native driver or if emulated using Propel.
668:      * @throws PropelException Any exceptions caught during processing will be
669:      *       rethrown wrapped into a PropelException.
670:      */
671:      public static function doDelete($values, PropelPDO $con = null)
672:      {
673:         if ($con === null) {
674:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
675:         }
676: 
677:         if ($values instanceof Criteria) {
678:             // invalidate the cache for all objects of this type, since we have no
679:             // way of knowing (without running a query) what objects should be invalidated
680:             // from the cache based on this Criteria.
681:             TaxRulePeer::clearInstancePool();
682:             // rename for clarity
683:             $criteria = clone $values;
684:         } elseif ($values instanceof TaxRule) { // it's a model object
685:             // invalidate the cache for this single object
686:             TaxRulePeer::removeInstanceFromPool($values);
687:             // create criteria based on pk values
688:             $criteria = $values->buildPkeyCriteria();
689:         } else { // it's a primary key, or an array of pks
690:             $criteria = new Criteria(TaxRulePeer::DATABASE_NAME);
691:             $criteria->add(TaxRulePeer::ID, (array) $values, Criteria::IN);
692:             // invalidate the cache for this object(s)
693:             foreach ((array) $values as $singleval) {
694:                 TaxRulePeer::removeInstanceFromPool($singleval);
695:             }
696:         }
697: 
698:         // Set the correct dbName
699:         $criteria->setDbName(TaxRulePeer::DATABASE_NAME);
700: 
701:         $affectedRows = 0; // initialize var to track total num of affected rows
702: 
703:         try {
704:             // use transaction because $criteria could contain info
705:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
706:             $con->beginTransaction();
707: 
708:             $affectedRows += BasePeer::doDelete($criteria, $con);
709:             TaxRulePeer::clearRelatedInstancePool();
710:             $con->commit();
711: 
712:             return $affectedRows;
713:         } catch (PropelException $e) {
714:             $con->rollBack();
715:             throw $e;
716:         }
717:     }
718: 
719:     /**
720:      * Validates all modified columns of given TaxRule object.
721:      * If parameter $columns is either a single column name or an array of column names
722:      * than only those columns are validated.
723:      *
724:      * NOTICE: This does not apply to primary or foreign keys for now.
725:      *
726:      * @param      TaxRule $obj The object to validate.
727:      * @param      mixed $cols Column name or array of column names.
728:      *
729:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
730:      */
731:     public static function doValidate($obj, $cols = null)
732:     {
733:         $columns = array();
734: 
735:         if ($cols) {
736:             $dbMap = Propel::getDatabaseMap(TaxRulePeer::DATABASE_NAME);
737:             $tableMap = $dbMap->getTable(TaxRulePeer::TABLE_NAME);
738: 
739:             if (! is_array($cols)) {
740:                 $cols = array($cols);
741:             }
742: 
743:             foreach ($cols as $colName) {
744:                 if ($tableMap->hasColumn($colName)) {
745:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
746:                     $columns[$colName] = $obj->$get();
747:                 }
748:             }
749:         } else {
750: 
751:         }
752: 
753:         return BasePeer::doValidate(TaxRulePeer::DATABASE_NAME, TaxRulePeer::TABLE_NAME, $columns);
754:     }
755: 
756:     /**
757:      * Retrieve a single object by pkey.
758:      *
759:      * @param      int $pk the primary key.
760:      * @param      PropelPDO $con the connection to use
761:      * @return TaxRule
762:      */
763:     public static function retrieveByPK($pk, PropelPDO $con = null)
764:     {
765: 
766:         if (null !== ($obj = TaxRulePeer::getInstanceFromPool((string) $pk))) {
767:             return $obj;
768:         }
769: 
770:         if ($con === null) {
771:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
772:         }
773: 
774:         $criteria = new Criteria(TaxRulePeer::DATABASE_NAME);
775:         $criteria->add(TaxRulePeer::ID, $pk);
776: 
777:         $v = TaxRulePeer::doSelect($criteria, $con);
778: 
779:         return !empty($v) > 0 ? $v[0] : null;
780:     }
781: 
782:     /**
783:      * Retrieve multiple objects by pkey.
784:      *
785:      * @param      array $pks List of primary keys
786:      * @param      PropelPDO $con the connection to use
787:      * @return TaxRule[]
788:      * @throws PropelException Any exceptions caught during processing will be
789:      *       rethrown wrapped into a PropelException.
790:      */
791:     public static function retrieveByPKs($pks, PropelPDO $con = null)
792:     {
793:         if ($con === null) {
794:             $con = Propel::getConnection(TaxRulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
795:         }
796: 
797:         $objs = null;
798:         if (empty($pks)) {
799:             $objs = array();
800:         } else {
801:             $criteria = new Criteria(TaxRulePeer::DATABASE_NAME);
802:             $criteria->add(TaxRulePeer::ID, $pks, Criteria::IN);
803:             $objs = TaxRulePeer::doSelect($criteria, $con);
804:         }
805: 
806:         return $objs;
807:     }
808: 
809: } // BaseTaxRulePeer
810: 
811: // This is the static code needed to register the TableMap for this table with the main Propel class.
812: //
813: BaseTaxRulePeer::buildTableMap();
814: 
815: 
thelia API documentation generated by ApiGen 2.8.0