       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\CountryPeer;
      13: use Thelia\Model\TaxPeer;
      14: use Thelia\Model\TaxRuleCountry;
      15: use Thelia\Model\TaxRuleCountryPeer;
      16: use Thelia\Model\TaxRulePeer;
      17: use Thelia\Model\map\TaxRuleCountryTableMap;
      18:
      19: /**
      20:  * Base static class for performing query and update operations on the 'tax_rule_country' table.
      21:  *
      22:  *
      23:  *
      24:  * @package propel.generator.Thelia.Model.om
      25:  */
      26: abstract class BaseTaxRuleCountryPeer
      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_country';
      34:
      35:     /** the related Propel class for this table */
      36:     const OM_CLASS = 'Thelia\\Model\\TaxRuleCountry';
      37:
      38:     /** the related TableMap class for this table */
      39:     const TM_CLASS = 'TaxRuleCountryTableMap';
      40:
      41:     /** The total number of columns. */
      42:     const NUM_COLUMNS = 7;
      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 = 7;
      49:
      50:     /** the column name for the id field */
      51:     const ID = 'tax_rule_country.id';
      52:
      53:     /** the column name for the tax_rule_id field */
      54:     const TAX_RULE_ID = 'tax_rule_country.tax_rule_id';
      55:
      56:     /** the column name for the country_id field */
      57:     const COUNTRY_ID = 'tax_rule_country.country_id';
      58:
      59:     /** the column name for the tax_id field */
      60:     const TAX_ID = 'tax_rule_country.tax_id';
      61:
      62:     /** the column name for the none field */
      63:     const NONE = 'tax_rule_country.none';
      64:
      65:     /** the column name for the created_at field */
      66:     const CREATED_AT = 'tax_rule_country.created_at';
      67:
      68:     /** the column name for the updated_at field */
      69:     const UPDATED_AT = 'tax_rule_country.updated_at';
      70:
      71:     /** The default string format for model objects of the related table **/
      72:     const DEFAULT_STRING_FORMAT = 'YAML';
      73:
      74:     /**
      75:      * An identiy map to hold any loaded instances of TaxRuleCountry objects.
      76:      * This must be public so that other peer classes can access this when hydrating from JOIN
      77:      * queries.
      78:      * @var        array TaxRuleCountry[]
      79:      */
      80:     public static $instances = array();
      81:
      82:
      83:     /**
      84:      * holds an array of fieldnames
      85:      *
      86:      * first dimension keys are the type constants
      87:      * e.g. TaxRuleCountryPeer::$fieldNames[TaxRuleCountryPeer::TYPE_PHPNAME][0] = 'Id'
      88:      */
      89:     protected static $fieldNames = array (
      90:         BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'CountryId', 'TaxId', 'None', 'CreatedAt', 'UpdatedAt', ),
      91:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'countryId', 'taxId', 'none', 'createdAt', 'updatedAt', ),
      92:         BasePeer::TYPE_COLNAME => array (TaxRuleCountryPeer::ID, TaxRuleCountryPeer::TAX_RULE_ID, TaxRuleCountryPeer::COUNTRY_ID, TaxRuleCountryPeer::TAX_ID, TaxRuleCountryPeer::NONE, TaxRuleCountryPeer::CREATED_AT, TaxRuleCountryPeer::UPDATED_AT, ),
      93:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'COUNTRY_ID', 'TAX_ID', 'NONE', 'CREATED_AT', 'UPDATED_AT', ),
      94:         BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'country_id', 'tax_id', 'none', 'created_at', 'updated_at', ),
      95:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
      96:     );
      97:
      98:     /**
      99:      * holds an array of keys for quick access to the fieldnames array
     100:      *
     101:      * first dimension keys are the type constants
     102:      * e.g. TaxRuleCountryPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
     103:      */
     104:     protected static $fieldKeys = array (
     105:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'CountryId' => 2, 'TaxId' => 3, 'None' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
     106:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'countryId' => 2, 'taxId' => 3, 'none' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
     107:         BasePeer::TYPE_COLNAME => array (TaxRuleCountryPeer::ID => 0, TaxRuleCountryPeer::TAX_RULE_ID => 1, TaxRuleCountryPeer::COUNTRY_ID => 2, TaxRuleCountryPeer::TAX_ID => 3, TaxRuleCountryPeer::NONE => 4, TaxRuleCountryPeer::CREATED_AT => 5, TaxRuleCountryPeer::UPDATED_AT => 6, ),
     108:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'COUNTRY_ID' => 2, 'TAX_ID' => 3, 'NONE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
     109:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'country_id' => 2, 'tax_id' => 3, 'none' => 4, 'created_at' => 5, 'updated_at' => 6, ),
     110:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
     111:     );
     112:
     113:     /**
     114:      * Translates a fieldname to another type
     115:      *
     116:      * @param      string $name field name
     117:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     118:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     119:      * @param      string $toType   One of the class type constants
     120:      * @return string          translated name of the field.
     121:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
     122:      */
     123:     public static function translateFieldName($name, $fromType, $toType)
     124:     {
     125:         $toNames = TaxRuleCountryPeer::getFieldNames($toType);
     126:         $key = isset(TaxRuleCountryPeer::$fieldKeys[$fromType][$name]) ? TaxRuleCountryPeer::$fieldKeys[$fromType][$name] : null;
     127:         if ($key === null) {
     128:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(TaxRuleCountryPeer::$fieldKeys[$fromType], true));
     129:         }
     130:
     131:         return $toNames[$key];
     132:     }
     133:
     134:     /**
     135:      * Returns an array of field names.
     136:      *
     137:      * @param      string $type The type of fieldnames to return:
     138:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     139:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     140:      * @return array           A list of field names
     141:      * @throws PropelException - if the type is not valid.
     142:      */
     143:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
     144:     {
     145:         if (!array_key_exists($type, TaxRuleCountryPeer::$fieldNames)) {
     146:             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.');
     147:         }
     148:
     149:         return TaxRuleCountryPeer::$fieldNames[$type];
     150:     }
     151:
     152:     /**
     153:      * Convenience method which changes table.column to alias.column.
     154:      *
     155:      * Using this method you can maintain SQL abstraction while using column aliases.
     156:      * <code>
     157:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
     158:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
     159:      * </code>
     160:      * @param      string $alias The alias for the current table.
     161:      * @param      string $column The column name for current table. (i.e. TaxRuleCountryPeer::COLUMN_NAME).
     162:      * @return string
     163:      */
     164:     public static function alias($alias, $column)
     165:     {
     166:         return str_replace(TaxRuleCountryPeer::TABLE_NAME.'.', $alias.'.', $column);
     167:     }
     168:
     169:     /**
     170:      * Add all the columns needed to create a new object.
     171:      *
     172:      * Note: any columns that were marked with lazyLoad="true" in the
     173:      * XML schema will not be added to the select list and only loaded
     174:      * on demand.
     175:      *
     176:      * @param      Criteria $criteria object containing the columns to add.
     177:      * @param      string   $alias    optional table alias
     178:      * @throws PropelException Any exceptions caught during processing will be
     179:      *       rethrown wrapped into a PropelException.
     180:      */
     181:     public static function addSelectColumns(Criteria $criteria, $alias = null)
     182:     {
     183:         if (null === $alias) {
     184:             $criteria->addSelectColumn(TaxRuleCountryPeer::ID);
     185:             $criteria->addSelectColumn(TaxRuleCountryPeer::TAX_RULE_ID);
     186:             $criteria->addSelectColumn(TaxRuleCountryPeer::COUNTRY_ID);
     187:             $criteria->addSelectColumn(TaxRuleCountryPeer::TAX_ID);
     188:             $criteria->addSelectColumn(TaxRuleCountryPeer::NONE);
     189:             $criteria->addSelectColumn(TaxRuleCountryPeer::CREATED_AT);
     190:             $criteria->addSelectColumn(TaxRuleCountryPeer::UPDATED_AT);
     191:         } else {
     192:             $criteria->addSelectColumn($alias . '.id');
     193:             $criteria->addSelectColumn($alias . '.tax_rule_id');
     194:             $criteria->addSelectColumn($alias . '.country_id');
     195:             $criteria->addSelectColumn($alias . '.tax_id');
     196:             $criteria->addSelectColumn($alias . '.none');
     197:             $criteria->addSelectColumn($alias . '.created_at');
     198:             $criteria->addSelectColumn($alias . '.updated_at');
     199:         }
     200:     }
     201:
     202:     /**
     203:      * Returns the number of rows matching criteria.
     204:      *
     205:      * @param      Criteria $criteria
     206:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     207:      * @param      PropelPDO $con
     208:      * @return int Number of matching rows.
     209:      */
     210:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
     211:     {
     212:         // we may modify criteria, so copy it first
     213:         $criteria = clone $criteria;
     214:
     215:         // We need to set the primary table name, since in the case that there are no WHERE columns
     216:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     217:         // tables go into the FROM clause.
     218:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     219:
     220:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     221:             $criteria->setDistinct();
     222:         }
     223:
     224:         if (!$criteria->hasSelectClause()) {
     225:             TaxRuleCountryPeer::addSelectColumns($criteria);
     226:         }
     227:
     228:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     229:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME); // Set the correct dbName
     230:
     231:         if ($con === null) {
     232:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     233:         }
     234:         // BasePeer returns a PDOStatement
     235:         $stmt = BasePeer::doCount($criteria, $con);
     236:
     237:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     238:             $count = (int) $row[0];
     239:         } else {
     240:             $count = 0; // no rows returned; we infer that means 0 matches.
     241:         }
     242:         $stmt->closeCursor();
     243:
     244:         return $count;
     245:     }
     246:     /**
     247:      * Selects one object from the DB.
     248:      *
     249:      * @param      Criteria $criteria object used to create the SELECT statement.
     250:      * @param      PropelPDO $con
     251:      * @return                 TaxRuleCountry
     252:      * @throws PropelException Any exceptions caught during processing will be
     253:      *       rethrown wrapped into a PropelException.
     254:      */
     255:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
     256:     {
     257:         $critcopy = clone $criteria;
     258:         $critcopy->setLimit(1);
     259:         $objects = TaxRuleCountryPeer::doSelect($critcopy, $con);
     260:         if ($objects) {
     261:             return $objects[0];
     262:         }
     263:
     264:         return null;
     265:     }
     266:     /**
     267:      * Selects several row from the DB.
     268:      *
     269:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     270:      * @param      PropelPDO $con
     271:      * @return array           Array of selected Objects
     272:      * @throws PropelException Any exceptions caught during processing will be
     273:      *       rethrown wrapped into a PropelException.
     274:      */
     275:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
     276:     {
     277:         return TaxRuleCountryPeer::populateObjects(TaxRuleCountryPeer::doSelectStmt($criteria, $con));
     278:     }
     279:     /**
     280:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
     281:      *
     282:      * Use this method directly if you want to work with an executed statement directly (for example
     283:      * to perform your own object hydration).
     284:      *
     285:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     286:      * @param      PropelPDO $con The connection to use
     287:      * @throws PropelException Any exceptions caught during processing will be
     288:      *       rethrown wrapped into a PropelException.
     289:      * @return PDOStatement The executed PDOStatement object.
     290:      * @see        BasePeer::doSelect()
     291:      */
     292:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
     293:     {
     294:         if ($con === null) {
     295:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     296:         }
     297:
     298:         if (!$criteria->hasSelectClause()) {
     299:             $criteria = clone $criteria;
     300:             TaxRuleCountryPeer::addSelectColumns($criteria);
     301:         }
     302:
     303:         // Set the correct dbName
     304:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     305:
     306:         // BasePeer returns a PDOStatement
     307:         return BasePeer::doSelect($criteria, $con);
     308:     }
     309:     /**
     310:      * Adds an object to the instance pool.
     311:      *
     312:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
     313:      * from the database.  In some cases -- especially when you override doSelect*()
     314:      * methods in your stub classes -- you may need to explicitly add objects
     315:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
     316:      * and retrieveByPK*() calls.
     317:      *
     318:      * @param      TaxRuleCountry $obj A TaxRuleCountry object.
     319:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
     320:      */
     321:     public static function addInstanceToPool($obj, $key = null)
     322:     {
     323:         if (Propel::isInstancePoolingEnabled()) {
     324:             if ($key === null) {
     325:                 $key = (string) $obj->getId();
     326:             } // if key === null
     327:             TaxRuleCountryPeer::$instances[$key] = $obj;
     328:         }
     329:     }
     330:
     331:     /**
     332:      * Removes an object from the instance pool.
     333:      *
     334:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
     335:      * from the database.  In some cases -- especially when you override doDelete
     336:      * methods in your stub classes -- you may need to explicitly remove objects
     337:      * from the cache in order to prevent returning objects that no longer exist.
     338:      *
     339:      * @param      mixed $value A TaxRuleCountry object or a primary key value.
     340:      *
     341:      * @return void
     342:      * @throws PropelException - if the value is invalid.
     343:      */
     344:     public static function removeInstanceFromPool($value)
     345:     {
     346:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
     347:             if (is_object($value) && $value instanceof TaxRuleCountry) {
     348:                 $key = (string) $value->getId();
     349:             } elseif (is_scalar($value)) {
     350:                 // assume we've been passed a primary key
     351:                 $key = (string) $value;
     352:             } else {
     353:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or TaxRuleCountry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
     354:                 throw $e;
     355:             }
     356:
     357:             unset(TaxRuleCountryPeer::$instances[$key]);
     358:         }
     359:     } // removeInstanceFromPool()
     360:
     361:     /**
     362:      * 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.
     363:      *
     364:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     365:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     366:      *
     367:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
     368:      * @return   TaxRuleCountry Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
     369:      * @see        getPrimaryKeyHash()
     370:      */
     371:     public static function getInstanceFromPool($key)
     372:     {
     373:         if (Propel::isInstancePoolingEnabled()) {
     374:             if (isset(TaxRuleCountryPeer::$instances[$key])) {
     375:                 return TaxRuleCountryPeer::$instances[$key];
     376:             }
     377:         }
     378:
     379:         return null; // just to be explicit
     380:     }
     381:
     382:     /**
     383:      * Clear the instance pool.
     384:      *
     385:      * @return void
     386:      */
     387:     public static function clearInstancePool($and_clear_all_references = false)
     388:     {
     389:       if ($and_clear_all_references)
     390:       {
     391:         foreach (TaxRuleCountryPeer::$instances as $instance)
     392:         {
     393:           $instance->clearAllReferences(true);
     394:         }
     395:       }
     396:         TaxRuleCountryPeer::$instances = array();
     397:     }
     398:
     399:     /**
     400:      * Method to invalidate the instance pool of all tables related to tax_rule_country
     401:      * by a foreign key with ON DELETE CASCADE
     402:      */
     403:     public static function clearRelatedInstancePool()
     404:     {
     405:     }
     406:
     407:     /**
     408:      * 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.
     409:      *
     410:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     411:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     412:      *
     413:      * @param      array $row PropelPDO resultset row.
     414:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     415:      * @return string A string version of PK or null if the components of primary key in result array are all null.
     416:      */
     417:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
     418:     {
     419:         // If the PK cannot be derived from the row, return null.
     420:         if ($row[$startcol] === null) {
     421:             return null;
     422:         }
     423:
     424:         return (string) $row[$startcol];
     425:     }
     426:
     427:     /**
     428:      * Retrieves the primary key from the DB resultset row
     429:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     430:      * a multi-column primary key, an array of the primary key columns will be returned.
     431:      *
     432:      * @param      array $row PropelPDO resultset row.
     433:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     434:      * @return mixed The primary key of the row
     435:      */
     436:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
     437:     {
     438:
     439:         return (int) $row[$startcol];
     440:     }
     441:
     442:     /**
     443:      * The returned array will contain objects of the default type or
     444:      * objects that inherit from the default.
     445:      *
     446:      * @throws PropelException Any exceptions caught during processing will be
     447:      *       rethrown wrapped into a PropelException.
     448:      */
     449:     public static function populateObjects(PDOStatement $stmt)
     450:     {
     451:         $results = array();
     452:
     453:         // set the class once to avoid overhead in the loop
     454:         $cls = TaxRuleCountryPeer::getOMClass();
     455:         // populate the object(s)
     456:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     457:             $key = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     458:             if (null !== ($obj = TaxRuleCountryPeer::getInstanceFromPool($key))) {
     459:                 // We no longer rehydrate the object, since this can cause data loss.
     460:                 // See http://www.propelorm.org/ticket/509
     461:                 // $obj->hydrate($row, 0, true); // rehydrate
     462:                 $results[] = $obj;
     463:             } else {
     464:                 $obj = new $cls();
     465:                 $obj->hydrate($row);
     466:                 $results[] = $obj;
     467:                 TaxRuleCountryPeer::addInstanceToPool($obj, $key);
     468:             } // if key exists
     469:         }
     470:         $stmt->closeCursor();
     471:
     472:         return $results;
     473:     }
     474:     /**
     475:      * Populates an object of the default type or an object that inherit from the default.
     476:      *
     477:      * @param      array $row PropelPDO resultset row.
     478:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     479:      * @throws PropelException Any exceptions caught during processing will be
     480:      *       rethrown wrapped into a PropelException.
     481:      * @return array (TaxRuleCountry object, last column rank)
     482:      */
     483:     public static function populateObject($row, $startcol = 0)
     484:     {
     485:         $key = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, $startcol);
     486:         if (null !== ($obj = TaxRuleCountryPeer::getInstanceFromPool($key))) {
     487:             // We no longer rehydrate the object, since this can cause data loss.
     488:             // See http://www.propelorm.org/ticket/509
     489:             // $obj->hydrate($row, $startcol, true); // rehydrate
     490:             $col = $startcol + TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     491:         } else {
     492:             $cls = TaxRuleCountryPeer::OM_CLASS;
     493:             $obj = new $cls();
     494:             $col = $obj->hydrate($row, $startcol);
     495:             TaxRuleCountryPeer::addInstanceToPool($obj, $key);
     496:         }
     497:
     498:         return array($obj, $col);
     499:     }
     500:
     501:
     502:     /**
     503:      * Returns the number of rows matching criteria, joining the related Tax table
     504:      *
     505:      * @param      Criteria $criteria
     506:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     507:      * @param      PropelPDO $con
     508:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     509:      * @return int Number of matching rows.
     510:      */
     511:     public static function doCountJoinTax(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     512:     {
     513:         // we're going to modify criteria, so copy it first
     514:         $criteria = clone $criteria;
     515:
     516:         // We need to set the primary table name, since in the case that there are no WHERE columns
     517:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     518:         // tables go into the FROM clause.
     519:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     520:
     521:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     522:             $criteria->setDistinct();
     523:         }
     524:
     525:         if (!$criteria->hasSelectClause()) {
     526:             TaxRuleCountryPeer::addSelectColumns($criteria);
     527:         }
     528:
     529:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     530:
     531:         // Set the correct dbName
     532:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     533:
     534:         if ($con === null) {
     535:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     536:         }
     537:
     538:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     539:
     540:         $stmt = BasePeer::doCount($criteria, $con);
     541:
     542:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     543:             $count = (int) $row[0];
     544:         } else {
     545:             $count = 0; // no rows returned; we infer that means 0 matches.
     546:         }
     547:         $stmt->closeCursor();
     548:
     549:         return $count;
     550:     }
     551:
     552:
     553:     /**
     554:      * Returns the number of rows matching criteria, joining the related TaxRule table
     555:      *
     556:      * @param      Criteria $criteria
     557:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     558:      * @param      PropelPDO $con
     559:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     560:      * @return int Number of matching rows.
     561:      */
     562:     public static function doCountJoinTaxRule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     563:     {
     564:         // we're going to modify criteria, so copy it first
     565:         $criteria = clone $criteria;
     566:
     567:         // We need to set the primary table name, since in the case that there are no WHERE columns
     568:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     569:         // tables go into the FROM clause.
     570:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     571:
     572:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     573:             $criteria->setDistinct();
     574:         }
     575:
     576:         if (!$criteria->hasSelectClause()) {
     577:             TaxRuleCountryPeer::addSelectColumns($criteria);
     578:         }
     579:
     580:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     581:
     582:         // Set the correct dbName
     583:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     584:
     585:         if ($con === null) {
     586:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     587:         }
     588:
     589:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     590:
     591:         $stmt = BasePeer::doCount($criteria, $con);
     592:
     593:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     594:             $count = (int) $row[0];
     595:         } else {
     596:             $count = 0; // no rows returned; we infer that means 0 matches.
     597:         }
     598:         $stmt->closeCursor();
     599:
     600:         return $count;
     601:     }
     602:
     603:
     604:     /**
     605:      * Returns the number of rows matching criteria, joining the related Country table
     606:      *
     607:      * @param      Criteria $criteria
     608:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     609:      * @param      PropelPDO $con
     610:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     611:      * @return int Number of matching rows.
     612:      */
     613:     public static function doCountJoinCountry(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     614:     {
     615:         // we're going to modify criteria, so copy it first
     616:         $criteria = clone $criteria;
     617:
     618:         // We need to set the primary table name, since in the case that there are no WHERE columns
     619:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     620:         // tables go into the FROM clause.
     621:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     622:
     623:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     624:             $criteria->setDistinct();
     625:         }
     626:
     627:         if (!$criteria->hasSelectClause()) {
     628:             TaxRuleCountryPeer::addSelectColumns($criteria);
     629:         }
     630:
     631:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     632:
     633:         // Set the correct dbName
     634:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     635:
     636:         if ($con === null) {
     637:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     638:         }
     639:
     640:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     641:
     642:         $stmt = BasePeer::doCount($criteria, $con);
     643:
     644:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     645:             $count = (int) $row[0];
     646:         } else {
     647:             $count = 0; // no rows returned; we infer that means 0 matches.
     648:         }
     649:         $stmt->closeCursor();
     650:
     651:         return $count;
     652:     }
     653:
     654:
     655:     /**
     656:      * Selects a collection of TaxRuleCountry objects pre-filled with their Tax objects.
     657:      * @param      Criteria  $criteria
     658:      * @param      PropelPDO $con
     659:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     660:      * @return array           Array of TaxRuleCountry objects.
     661:      * @throws PropelException Any exceptions caught during processing will be
     662:      *       rethrown wrapped into a PropelException.
     663:      */
     664:     public static function doSelectJoinTax(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     665:     {
     666:         $criteria = clone $criteria;
     667:
     668:         // Set the correct dbName if it has not been overridden
     669:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     670:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     671:         }
     672:
     673:         TaxRuleCountryPeer::addSelectColumns($criteria);
     674:         $startcol = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     675:         TaxPeer::addSelectColumns($criteria);
     676:
     677:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     678:
     679:         $stmt = BasePeer::doSelect($criteria, $con);
     680:         $results = array();
     681:
     682:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     683:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     684:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     685:                 // We no longer rehydrate the object, since this can cause data loss.
     686:                 // See http://www.propelorm.org/ticket/509
     687:                 // $obj1->hydrate($row, 0, true); // rehydrate
     688:             } else {
     689:
     690:                 $cls = TaxRuleCountryPeer::getOMClass();
     691:
     692:                 $obj1 = new $cls();
     693:                 $obj1->hydrate($row);
     694:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     695:             } // if $obj1 already loaded
     696:
     697:             $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol);
     698:             if ($key2 !== null) {
     699:                 $obj2 = TaxPeer::getInstanceFromPool($key2);
     700:                 if (!$obj2) {
     701:
     702:                     $cls = TaxPeer::getOMClass();
     703:
     704:                     $obj2 = new $cls();
     705:                     $obj2->hydrate($row, $startcol);
     706:                     TaxPeer::addInstanceToPool($obj2, $key2);
     707:                 } // if obj2 already loaded
     708:
     709:                 // Add the $obj1 (TaxRuleCountry) to $obj2 (Tax)
     710:                 $obj2->addTaxRuleCountry($obj1);
     711:
     712:             } // if joined row was not null
     713:
     714:             $results[] = $obj1;
     715:         }
     716:         $stmt->closeCursor();
     717:
     718:         return $results;
     719:     }
     720:
     721:
     722:     /**
     723:      * Selects a collection of TaxRuleCountry objects pre-filled with their TaxRule objects.
     724:      * @param      Criteria  $criteria
     725:      * @param      PropelPDO $con
     726:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     727:      * @return array           Array of TaxRuleCountry objects.
     728:      * @throws PropelException Any exceptions caught during processing will be
     729:      *       rethrown wrapped into a PropelException.
     730:      */
     731:     public static function doSelectJoinTaxRule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     732:     {
     733:         $criteria = clone $criteria;
     734:
     735:         // Set the correct dbName if it has not been overridden
     736:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     737:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     738:         }
     739:
     740:         TaxRuleCountryPeer::addSelectColumns($criteria);
     741:         $startcol = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     742:         TaxRulePeer::addSelectColumns($criteria);
     743:
     744:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     745:
     746:         $stmt = BasePeer::doSelect($criteria, $con);
     747:         $results = array();
     748:
     749:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     750:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     751:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     752:                 // We no longer rehydrate the object, since this can cause data loss.
     753:                 // See http://www.propelorm.org/ticket/509
     754:                 // $obj1->hydrate($row, 0, true); // rehydrate
     755:             } else {
     756:
     757:                 $cls = TaxRuleCountryPeer::getOMClass();
     758:
     759:                 $obj1 = new $cls();
     760:                 $obj1->hydrate($row);
     761:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     762:             } // if $obj1 already loaded
     763:
     764:             $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol);
     765:             if ($key2 !== null) {
     766:                 $obj2 = TaxRulePeer::getInstanceFromPool($key2);
     767:                 if (!$obj2) {
     768:
     769:                     $cls = TaxRulePeer::getOMClass();
     770:
     771:                     $obj2 = new $cls();
     772:                     $obj2->hydrate($row, $startcol);
     773:                     TaxRulePeer::addInstanceToPool($obj2, $key2);
     774:                 } // if obj2 already loaded
     775:
     776:                 // Add the $obj1 (TaxRuleCountry) to $obj2 (TaxRule)
     777:                 $obj2->addTaxRuleCountry($obj1);
     778:
     779:             } // if joined row was not null
     780:
     781:             $results[] = $obj1;
     782:         }
     783:         $stmt->closeCursor();
     784:
     785:         return $results;
     786:     }
     787:
     788:
     789:     /**
     790:      * Selects a collection of TaxRuleCountry objects pre-filled with their Country objects.
     791:      * @param      Criteria  $criteria
     792:      * @param      PropelPDO $con
     793:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     794:      * @return array           Array of TaxRuleCountry objects.
     795:      * @throws PropelException Any exceptions caught during processing will be
     796:      *       rethrown wrapped into a PropelException.
     797:      */
     798:     public static function doSelectJoinCountry(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     799:     {
     800:         $criteria = clone $criteria;
     801:
     802:         // Set the correct dbName if it has not been overridden
     803:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     804:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     805:         }
     806:
     807:         TaxRuleCountryPeer::addSelectColumns($criteria);
     808:         $startcol = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     809:         CountryPeer::addSelectColumns($criteria);
     810:
     811:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     812:
     813:         $stmt = BasePeer::doSelect($criteria, $con);
     814:         $results = array();
     815:
     816:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     817:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     818:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     819:                 // We no longer rehydrate the object, since this can cause data loss.
     820:                 // See http://www.propelorm.org/ticket/509
     821:                 // $obj1->hydrate($row, 0, true); // rehydrate
     822:             } else {
     823:
     824:                 $cls = TaxRuleCountryPeer::getOMClass();
     825:
     826:                 $obj1 = new $cls();
     827:                 $obj1->hydrate($row);
     828:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     829:             } // if $obj1 already loaded
     830:
     831:             $key2 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol);
     832:             if ($key2 !== null) {
     833:                 $obj2 = CountryPeer::getInstanceFromPool($key2);
     834:                 if (!$obj2) {
     835:
     836:                     $cls = CountryPeer::getOMClass();
     837:
     838:                     $obj2 = new $cls();
     839:                     $obj2->hydrate($row, $startcol);
     840:                     CountryPeer::addInstanceToPool($obj2, $key2);
     841:                 } // if obj2 already loaded
     842:
     843:                 // Add the $obj1 (TaxRuleCountry) to $obj2 (Country)
     844:                 $obj2->addTaxRuleCountry($obj1);
     845:
     846:             } // if joined row was not null
     847:
     848:             $results[] = $obj1;
     849:         }
     850:         $stmt->closeCursor();
     851:
     852:         return $results;
     853:     }
     854:
     855:
     856:     /**
     857:      * Returns the number of rows matching criteria, joining all related tables
     858:      *
     859:      * @param      Criteria $criteria
     860:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     861:      * @param      PropelPDO $con
     862:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     863:      * @return int Number of matching rows.
     864:      */
     865:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     866:     {
     867:         // we're going to modify criteria, so copy it first
     868:         $criteria = clone $criteria;
     869:
     870:         // We need to set the primary table name, since in the case that there are no WHERE columns
     871:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     872:         // tables go into the FROM clause.
     873:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     874:
     875:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     876:             $criteria->setDistinct();
     877:         }
     878:
     879:         if (!$criteria->hasSelectClause()) {
     880:             TaxRuleCountryPeer::addSelectColumns($criteria);
     881:         }
     882:
     883:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     884:
     885:         // Set the correct dbName
     886:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     887:
     888:         if ($con === null) {
     889:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     890:         }
     891:
     892:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     893:
     894:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     895:
     896:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     897:
     898:         $stmt = BasePeer::doCount($criteria, $con);
     899:
     900:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     901:             $count = (int) $row[0];
     902:         } else {
     903:             $count = 0; // no rows returned; we infer that means 0 matches.
     904:         }
     905:         $stmt->closeCursor();
     906:
     907:         return $count;
     908:     }
     909:
     910:     /**
     911:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects.
     912:      *
     913:      * @param      Criteria  $criteria
     914:      * @param      PropelPDO $con
     915:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     916:      * @return array           Array of TaxRuleCountry objects.
     917:      * @throws PropelException Any exceptions caught during processing will be
     918:      *       rethrown wrapped into a PropelException.
     919:      */
     920:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     921:     {
     922:         $criteria = clone $criteria;
     923:
     924:         // Set the correct dbName if it has not been overridden
     925:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     926:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     927:         }
     928:
     929:         TaxRuleCountryPeer::addSelectColumns($criteria);
     930:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     931:
     932:         TaxPeer::addSelectColumns($criteria);
     933:         $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS;
     934:
     935:         TaxRulePeer::addSelectColumns($criteria);
     936:         $startcol4 = $startcol3 + TaxRulePeer::NUM_HYDRATE_COLUMNS;
     937:
     938:         CountryPeer::addSelectColumns($criteria);
     939:         $startcol5 = $startcol4 + CountryPeer::NUM_HYDRATE_COLUMNS;
     940:
     941:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     942:
     943:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     944:
     945:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     946:
     947:         $stmt = BasePeer::doSelect($criteria, $con);
     948:         $results = array();
     949:
     950:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     951:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     952:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     953:                 // We no longer rehydrate the object, since this can cause data loss.
     954:                 // See http://www.propelorm.org/ticket/509
     955:                 // $obj1->hydrate($row, 0, true); // rehydrate
     956:             } else {
     957:                 $cls = TaxRuleCountryPeer::getOMClass();
     958:
     959:                 $obj1 = new $cls();
     960:                 $obj1->hydrate($row);
     961:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     962:             } // if obj1 already loaded
     963:
     964:             // Add objects for joined Tax rows
     965:
     966:             $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2);
     967:             if ($key2 !== null) {
     968:                 $obj2 = TaxPeer::getInstanceFromPool($key2);
     969:                 if (!$obj2) {
     970:
     971:                     $cls = TaxPeer::getOMClass();
     972:
     973:                     $obj2 = new $cls();
     974:                     $obj2->hydrate($row, $startcol2);
     975:                     TaxPeer::addInstanceToPool($obj2, $key2);
     976:                 } // if obj2 loaded
     977:
     978:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (Tax)
     979:                 $obj2->addTaxRuleCountry($obj1);
     980:             } // if joined row not null
     981:
     982:             // Add objects for joined TaxRule rows
     983:
     984:             $key3 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol3);
     985:             if ($key3 !== null) {
     986:                 $obj3 = TaxRulePeer::getInstanceFromPool($key3);
     987:                 if (!$obj3) {
     988:
     989:                     $cls = TaxRulePeer::getOMClass();
     990:
     991:                     $obj3 = new $cls();
     992:                     $obj3->hydrate($row, $startcol3);
     993:                     TaxRulePeer::addInstanceToPool($obj3, $key3);
     994:                 } // if obj3 loaded
     995:
     996:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (TaxRule)
     997:                 $obj3->addTaxRuleCountry($obj1);
     998:             } // if joined row not null
     999:
    1000:             // Add objects for joined Country rows
    1001:
    1002:             $key4 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol4);
    1003:             if ($key4 !== null) {
    1004:                 $obj4 = CountryPeer::getInstanceFromPool($key4);
    1005:                 if (!$obj4) {
    1006:
    1007:                     $cls = CountryPeer::getOMClass();
    1008:
    1009:                     $obj4 = new $cls();
    1010:                     $obj4->hydrate($row, $startcol4);
    1011:                     CountryPeer::addInstanceToPool($obj4, $key4);
    1012:                 } // if obj4 loaded
    1013:
    1014:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj4 (Country)
    1015:                 $obj4->addTaxRuleCountry($obj1);
    1016:             } // if joined row not null
    1017:
    1018:             $results[] = $obj1;
    1019:         }
    1020:         $stmt->closeCursor();
    1021:
    1022:         return $results;
    1023:     }
    1024:
    1025:
    1026:     /**
    1027:      * Returns the number of rows matching criteria, joining the related Tax table
    1028:      *
    1029:      * @param      Criteria $criteria
    1030:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1031:      * @param      PropelPDO $con
    1032:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1033:      * @return int Number of matching rows.
    1034:      */
    1035:     public static function doCountJoinAllExceptTax(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1036:     {
    1037:         // we're going to modify criteria, so copy it first
    1038:         $criteria = clone $criteria;
    1039:
    1040:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1041:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1042:         // tables go into the FROM clause.
    1043:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1044:
    1045:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1046:             $criteria->setDistinct();
    1047:         }
    1048:
    1049:         if (!$criteria->hasSelectClause()) {
    1050:             TaxRuleCountryPeer::addSelectColumns($criteria);
    1051:         }
    1052:
    1053:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1054:
    1055:         // Set the correct dbName
    1056:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1057:
    1058:         if ($con === null) {
    1059:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1060:         }
    1061:
    1062:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1063:
    1064:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1065:
    1066:         $stmt = BasePeer::doCount($criteria, $con);
    1067:
    1068:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1069:             $count = (int) $row[0];
    1070:         } else {
    1071:             $count = 0; // no rows returned; we infer that means 0 matches.
    1072:         }
    1073:         $stmt->closeCursor();
    1074:
    1075:         return $count;
    1076:     }
    1077:
    1078:
    1079:     /**
    1080:      * Returns the number of rows matching criteria, joining the related TaxRule table
    1081:      *
    1082:      * @param      Criteria $criteria
    1083:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1084:      * @param      PropelPDO $con
    1085:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1086:      * @return int Number of matching rows.
    1087:      */
    1088:     public static function doCountJoinAllExceptTaxRule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1089:     {
    1090:         // we're going to modify criteria, so copy it first
    1091:         $criteria = clone $criteria;
    1092:
    1093:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1094:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1095:         // tables go into the FROM clause.
    1096:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1097:
    1098:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1099:             $criteria->setDistinct();
    1100:         }
    1101:
    1102:         if (!$criteria->hasSelectClause()) {
    1103:             TaxRuleCountryPeer::addSelectColumns($criteria);
    1104:         }
    1105:
    1106:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1107:
    1108:         // Set the correct dbName
    1109:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1110:
    1111:         if ($con === null) {
    1112:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1113:         }
    1114:
    1115:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1116:
    1117:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1118:
    1119:         $stmt = BasePeer::doCount($criteria, $con);
    1120:
    1121:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1122:             $count = (int) $row[0];
    1123:         } else {
    1124:             $count = 0; // no rows returned; we infer that means 0 matches.
    1125:         }
    1126:         $stmt->closeCursor();
    1127:
    1128:         return $count;
    1129:     }
    1130:
    1131:
    1132:     /**
    1133:      * Returns the number of rows matching criteria, joining the related Country table
    1134:      *
    1135:      * @param      Criteria $criteria
    1136:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1137:      * @param      PropelPDO $con
    1138:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1139:      * @return int Number of matching rows.
    1140:      */
    1141:     public static function doCountJoinAllExceptCountry(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1142:     {
    1143:         // we're going to modify criteria, so copy it first
    1144:         $criteria = clone $criteria;
    1145:
    1146:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1147:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1148:         // tables go into the FROM clause.
    1149:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1150:
    1151:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1152:             $criteria->setDistinct();
    1153:         }
    1154:
    1155:         if (!$criteria->hasSelectClause()) {
    1156:             TaxRuleCountryPeer::addSelectColumns($criteria);
    1157:         }
    1158:
    1159:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1160:
    1161:         // Set the correct dbName
    1162:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1163:
    1164:         if ($con === null) {
    1165:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1166:         }
    1167:
    1168:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1169:
    1170:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1171:
    1172:         $stmt = BasePeer::doCount($criteria, $con);
    1173:
    1174:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1175:             $count = (int) $row[0];
    1176:         } else {
    1177:             $count = 0; // no rows returned; we infer that means 0 matches.
    1178:         }
    1179:         $stmt->closeCursor();
    1180:
    1181:         return $count;
    1182:     }
    1183:
    1184:
    1185:     /**
    1186:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects except Tax.
    1187:      *
    1188:      * @param      Criteria  $criteria
    1189:      * @param      PropelPDO $con
    1190:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1191:      * @return array           Array of TaxRuleCountry objects.
    1192:      * @throws PropelException Any exceptions caught during processing will be
    1193:      *       rethrown wrapped into a PropelException.
    1194:      */
    1195:     public static function doSelectJoinAllExceptTax(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1196:     {
    1197:         $criteria = clone $criteria;
    1198:
    1199:         // Set the correct dbName if it has not been overridden
    1200:         // $criteria->getDbName() will return the same object if not set to another value
    1201:         // so == check is okay and faster
    1202:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1203:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1204:         }
    1205:
    1206:         TaxRuleCountryPeer::addSelectColumns($criteria);
    1207:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
    1208:
    1209:         TaxRulePeer::addSelectColumns($criteria);
    1210:         $startcol3 = $startcol2 + TaxRulePeer::NUM_HYDRATE_COLUMNS;
    1211:
    1212:         CountryPeer::addSelectColumns($criteria);
    1213:         $startcol4 = $startcol3 + CountryPeer::NUM_HYDRATE_COLUMNS;
    1214:
    1215:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1216:
    1217:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1218:
    1219:
    1220:         $stmt = BasePeer::doSelect($criteria, $con);
    1221:         $results = array();
    1222:
    1223:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1224:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
    1225:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
    1226:                 // We no longer rehydrate the object, since this can cause data loss.
    1227:                 // See http://www.propelorm.org/ticket/509
    1228:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1229:             } else {
    1230:                 $cls = TaxRuleCountryPeer::getOMClass();
    1231:
    1232:                 $obj1 = new $cls();
    1233:                 $obj1->hydrate($row);
    1234:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
    1235:             } // if obj1 already loaded
    1236:
    1237:                 // Add objects for joined TaxRule rows
    1238:
    1239:                 $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1240:                 if ($key2 !== null) {
    1241:                     $obj2 = TaxRulePeer::getInstanceFromPool($key2);
    1242:                     if (!$obj2) {
    1243:
    1244:                         $cls = TaxRulePeer::getOMClass();
    1245:
    1246:                     $obj2 = new $cls();
    1247:                     $obj2->hydrate($row, $startcol2);
    1248:                     TaxRulePeer::addInstanceToPool($obj2, $key2);
    1249:                 } // if $obj2 already loaded
    1250:
    1251:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (TaxRule)
    1252:                 $obj2->addTaxRuleCountry($obj1);
    1253:
    1254:             } // if joined row is not null
    1255:
    1256:                 // Add objects for joined Country rows
    1257:
    1258:                 $key3 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1259:                 if ($key3 !== null) {
    1260:                     $obj3 = CountryPeer::getInstanceFromPool($key3);
    1261:                     if (!$obj3) {
    1262:
    1263:                         $cls = CountryPeer::getOMClass();
    1264:
    1265:                     $obj3 = new $cls();
    1266:                     $obj3->hydrate($row, $startcol3);
    1267:                     CountryPeer::addInstanceToPool($obj3, $key3);
    1268:                 } // if $obj3 already loaded
    1269:
    1270:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (Country)
    1271:                 $obj3->addTaxRuleCountry($obj1);
    1272:
    1273:             } // if joined row is not null
    1274:
    1275:             $results[] = $obj1;
    1276:         }
    1277:         $stmt->closeCursor();
    1278:
    1279:         return $results;
    1280:     }
    1281:
    1282:
    1283:     /**
    1284:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects except TaxRule.
    1285:      *
    1286:      * @param      Criteria  $criteria
    1287:      * @param      PropelPDO $con
    1288:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1289:      * @return array           Array of TaxRuleCountry objects.
    1290:      * @throws PropelException Any exceptions caught during processing will be
    1291:      *       rethrown wrapped into a PropelException.
    1292:      */
    1293:     public static function doSelectJoinAllExceptTaxRule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1294:     {
    1295:         $criteria = clone $criteria;
    1296:
    1297:         // Set the correct dbName if it has not been overridden
    1298:         // $criteria->getDbName() will return the same object if not set to another value
    1299:         // so == check is okay and faster
    1300:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1301:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1302:         }
    1303:
    1304:         TaxRuleCountryPeer::addSelectColumns($criteria);
    1305:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
    1306:
    1307:         TaxPeer::addSelectColumns($criteria);
    1308:         $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS;
    1309:
    1310:         CountryPeer::addSelectColumns($criteria);
    1311:         $startcol4 = $startcol3 + CountryPeer::NUM_HYDRATE_COLUMNS;
    1312:
    1313:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1314:
    1315:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1316:
    1317:
    1318:         $stmt = BasePeer::doSelect($criteria, $con);
    1319:         $results = array();
    1320:
    1321:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1322:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
    1323:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
    1324:                 // We no longer rehydrate the object, since this can cause data loss.
    1325:                 // See http://www.propelorm.org/ticket/509
    1326:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1327:             } else {
    1328:                 $cls = TaxRuleCountryPeer::getOMClass();
    1329:
    1330:                 $obj1 = new $cls();
    1331:                 $obj1->hydrate($row);
    1332:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
    1333:             } // if obj1 already loaded
    1334:
    1335:                 // Add objects for joined Tax rows
    1336:
    1337:                 $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1338:                 if ($key2 !== null) {
    1339:                     $obj2 = TaxPeer::getInstanceFromPool($key2);
    1340:                     if (!$obj2) {
    1341:
    1342:                         $cls = TaxPeer::getOMClass();
    1343:
    1344:                     $obj2 = new $cls();
    1345:                     $obj2->hydrate($row, $startcol2);
    1346:                     TaxPeer::addInstanceToPool($obj2, $key2);
    1347:                 } // if $obj2 already loaded
    1348:
    1349:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (Tax)
    1350:                 $obj2->addTaxRuleCountry($obj1);
    1351:
    1352:             } // if joined row is not null
    1353:
    1354:                 // Add objects for joined Country rows
    1355:
    1356:                 $key3 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1357:                 if ($key3 !== null) {
    1358:                     $obj3 = CountryPeer::getInstanceFromPool($key3);
    1359:                     if (!$obj3) {
    1360:
    1361:                         $cls = CountryPeer::getOMClass();
    1362:
    1363:                     $obj3 = new $cls();
    1364:                     $obj3->hydrate($row, $startcol3);
    1365:                     CountryPeer::addInstanceToPool($obj3, $key3);
    1366:                 } // if $obj3 already loaded
    1367:
    1368:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (Country)
    1369:                 $obj3->addTaxRuleCountry($obj1);
    1370:
    1371:             } // if joined row is not null
    1372:
    1373:             $results[] = $obj1;
    1374:         }
    1375:         $stmt->closeCursor();
    1376:
    1377:         return $results;
    1378:     }
    1379:
    1380:
    1381:     /**
    1382:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects except Country.
    1383:      *
    1384:      * @param      Criteria  $criteria
    1385:      * @param      PropelPDO $con
    1386:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1387:      * @return array           Array of TaxRuleCountry objects.
    1388:      * @throws PropelException Any exceptions caught during processing will be
    1389:      *       rethrown wrapped into a PropelException.
    1390:      */
    1391:     public static function doSelectJoinAllExceptCountry(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1392:     {
    1393:         $criteria = clone $criteria;
    1394:
    1395:         // Set the correct dbName if it has not been overridden
    1396:         // $criteria->getDbName() will return the same object if not set to another value
    1397:         // so == check is okay and faster
    1398:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1399:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1400:         }
    1401:
    1402:         TaxRuleCountryPeer::addSelectColumns($criteria);
    1403:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
    1404:
    1405:         TaxPeer::addSelectColumns($criteria);
    1406:         $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS;
    1407:
    1408:         TaxRulePeer::addSelectColumns($criteria);
    1409:         $startcol4 = $startcol3 + TaxRulePeer::NUM_HYDRATE_COLUMNS;
    1410:
    1411:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1412:
    1413:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1414:
    1415:
    1416:         $stmt = BasePeer::doSelect($criteria, $con);
    1417:         $results = array();
    1418:
    1419:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1420:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
    1421:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
    1422:                 // We no longer rehydrate the object, since this can cause data loss.
    1423:                 // See http://www.propelorm.org/ticket/509
    1424:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1425:             } else {
    1426:                 $cls = TaxRuleCountryPeer::getOMClass();
    1427:
    1428:                 $obj1 = new $cls();
    1429:                 $obj1->hydrate($row);
    1430:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
    1431:             } // if obj1 already loaded
    1432:
    1433:                 // Add objects for joined Tax rows
    1434:
    1435:                 $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1436:                 if ($key2 !== null) {
    1437:                     $obj2 = TaxPeer::getInstanceFromPool($key2);
    1438:                     if (!$obj2) {
    1439:
    1440:                         $cls = TaxPeer::getOMClass();
    1441:
    1442:                     $obj2 = new $cls();
    1443:                     $obj2->hydrate($row, $startcol2);
    1444:                     TaxPeer::addInstanceToPool($obj2, $key2);
    1445:                 } // if $obj2 already loaded
    1446:
    1447:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (Tax)
    1448:                 $obj2->addTaxRuleCountry($obj1);
    1449:
    1450:             } // if joined row is not null
    1451:
    1452:                 // Add objects for joined TaxRule rows
    1453:
    1454:                 $key3 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1455:                 if ($key3 !== null) {
    1456:                     $obj3 = TaxRulePeer::getInstanceFromPool($key3);
    1457:                     if (!$obj3) {
    1458:
    1459:                         $cls = TaxRulePeer::getOMClass();
    1460:
    1461:                     $obj3 = new $cls();
    1462:                     $obj3->hydrate($row, $startcol3);
    1463:                     TaxRulePeer::addInstanceToPool($obj3, $key3);
    1464:                 } // if $obj3 already loaded
    1465:
    1466:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (TaxRule)
    1467:                 $obj3->addTaxRuleCountry($obj1);
    1468:
    1469:             } // if joined row is not null
    1470:
    1471:             $results[] = $obj1;
    1472:         }
    1473:         $stmt->closeCursor();
    1474:
    1475:         return $results;
    1476:     }
    1477:
    1478:     /**
    1479:      * Returns the TableMap related to this peer.
    1480:      * This method is not needed for general use but a specific application could have a need.
    1481:      * @return TableMap
    1482:      * @throws PropelException Any exceptions caught during processing will be
    1483:      *       rethrown wrapped into a PropelException.
    1484:      */
    1485:     public static function getTableMap()
    1486:     {
    1487:         return Propel::getDatabaseMap(TaxRuleCountryPeer::DATABASE_NAME)->getTable(TaxRuleCountryPeer::TABLE_NAME);
    1488:     }
    1489:
    1490:     /**
    1491:      * Add a TableMap instance to the database for this peer class.
    1492:      */
    1493:     public static function buildTableMap()
    1494:     {
    1495:       $dbMap = Propel::getDatabaseMap(BaseTaxRuleCountryPeer::DATABASE_NAME);
    1496:       if (!$dbMap->hasTable(BaseTaxRuleCountryPeer::TABLE_NAME)) {
    1497:         $dbMap->addTableObject(new TaxRuleCountryTableMap());
    1498:       }
    1499:     }
    1500:
    1501:     /**
    1502:      * The class that the Peer will make instances of.
    1503:      *
    1504:      *
    1505:      * @return string ClassName
    1506:      */
    1507:     public static function getOMClass($row = 0, $colnum = 0)
    1508:     {
    1509:         return TaxRuleCountryPeer::OM_CLASS;
    1510:     }
    1511:
    1512:     /**
    1513:      * Performs an INSERT on the database, given a TaxRuleCountry or Criteria object.
    1514:      *
    1515:      * @param      mixed $values Criteria or TaxRuleCountry object containing data that is used to create the INSERT statement.
    1516:      * @param      PropelPDO $con the PropelPDO connection to use
    1517:      * @return mixed           The new primary key.
    1518:      * @throws PropelException Any exceptions caught during processing will be
    1519:      *       rethrown wrapped into a PropelException.
    1520:      */
    1521:     public static function doInsert($values, PropelPDO $con = null)
    1522:     {
    1523:         if ($con === null) {
    1524:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1525:         }
    1526:
    1527:         if ($values instanceof Criteria) {
    1528:             $criteria = clone $values; // rename for clarity
    1529:         } else {
    1530:             $criteria = $values->buildCriteria(); // build Criteria from TaxRuleCountry object
    1531:         }
    1532:
    1533:
    1534:         // Set the correct dbName
    1535:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1536:
    1537:         try {
    1538:             // use transaction because $criteria could contain info
    1539:             // for more than one table (I guess, conceivably)
    1540:             $con->beginTransaction();
    1541:             $pk = BasePeer::doInsert($criteria, $con);
    1542:             $con->commit();
    1543:         } catch (PropelException $e) {
    1544:             $con->rollBack();
    1545:             throw $e;
    1546:         }
    1547:
    1548:         return $pk;
    1549:     }
    1550:
    1551:     /**
    1552:      * Performs an UPDATE on the database, given a TaxRuleCountry or Criteria object.
    1553:      *
    1554:      * @param      mixed $values Criteria or TaxRuleCountry object containing data that is used to create the UPDATE statement.
    1555:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
    1556:      * @return int             The number of affected rows (if supported by underlying database driver).
    1557:      * @throws PropelException Any exceptions caught during processing will be
    1558:      *       rethrown wrapped into a PropelException.
    1559:      */
    1560:     public static function doUpdate($values, PropelPDO $con = null)
    1561:     {
    1562:         if ($con === null) {
    1563:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1564:         }
    1565:
    1566:         $selectCriteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1567:
    1568:         if ($values instanceof Criteria) {
    1569:             $criteria = clone $values; // rename for clarity
    1570:
    1571:             $comparison = $criteria->getComparison(TaxRuleCountryPeer::ID);
    1572:             $value = $criteria->remove(TaxRuleCountryPeer::ID);
    1573:             if ($value) {
    1574:                 $selectCriteria->add(TaxRuleCountryPeer::ID, $value, $comparison);
    1575:             } else {
    1576:                 $selectCriteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1577:             }
    1578:
    1579:         } else { // $values is TaxRuleCountry object
    1580:             $criteria = $values->buildCriteria(); // gets full criteria
    1581:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
    1582:         }
    1583:
    1584:         // set the correct dbName
    1585:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1586:
    1587:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
    1588:     }
    1589:
    1590:     /**
    1591:      * Deletes all rows from the tax_rule_country table.
    1592:      *
    1593:      * @param      PropelPDO $con the connection to use
    1594:      * @return int             The number of affected rows (if supported by underlying database driver).
    1595:      * @throws PropelException
    1596:      */
    1597:     public static function doDeleteAll(PropelPDO $con = null)
    1598:     {
    1599:         if ($con === null) {
    1600:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1601:         }
    1602:         $affectedRows = 0; // initialize var to track total num of affected rows
    1603:         try {
    1604:             // use transaction because $criteria could contain info
    1605:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1606:             $con->beginTransaction();
    1607:             $affectedRows += BasePeer::doDeleteAll(TaxRuleCountryPeer::TABLE_NAME, $con, TaxRuleCountryPeer::DATABASE_NAME);
    1608:             // Because this db requires some delete cascade/set null emulation, we have to
    1609:             // clear the cached instance *after* the emulation has happened (since
    1610:             // instances get re-added by the select statement contained therein).
    1611:             TaxRuleCountryPeer::clearInstancePool();
    1612:             TaxRuleCountryPeer::clearRelatedInstancePool();
    1613:             $con->commit();
    1614:
    1615:             return $affectedRows;
    1616:         } catch (PropelException $e) {
    1617:             $con->rollBack();
    1618:             throw $e;
    1619:         }
    1620:     }
    1621:
    1622:     /**
    1623:      * Performs a DELETE on the database, given a TaxRuleCountry or Criteria object OR a primary key value.
    1624:      *
    1625:      * @param      mixed $values Criteria or TaxRuleCountry object or primary key or array of primary keys
    1626:      *              which is used to create the DELETE statement
    1627:      * @param      PropelPDO $con the connection to use
    1628:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
    1629:      *              if supported by native driver or if emulated using Propel.
    1630:      * @throws PropelException Any exceptions caught during processing will be
    1631:      *       rethrown wrapped into a PropelException.
    1632:      */
    1633:      public static function doDelete($values, PropelPDO $con = null)
    1634:      {
    1635:         if ($con === null) {
    1636:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1637:         }
    1638:
    1639:         if ($values instanceof Criteria) {
    1640:             // invalidate the cache for all objects of this type, since we have no
    1641:             // way of knowing (without running a query) what objects should be invalidated
    1642:             // from the cache based on this Criteria.
    1643:             TaxRuleCountryPeer::clearInstancePool();
    1644:             // rename for clarity
    1645:             $criteria = clone $values;
    1646:         } elseif ($values instanceof TaxRuleCountry) { // it's a model object
    1647:             // invalidate the cache for this single object
    1648:             TaxRuleCountryPeer::removeInstanceFromPool($values);
    1649:             // create criteria based on pk values
    1650:             $criteria = $values->buildPkeyCriteria();
    1651:         } else { // it's a primary key, or an array of pks
    1652:             $criteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1653:             $criteria->add(TaxRuleCountryPeer::ID, (array) $values, Criteria::IN);
    1654:             // invalidate the cache for this object(s)
    1655:             foreach ((array) $values as $singleval) {
    1656:                 TaxRuleCountryPeer::removeInstanceFromPool($singleval);
    1657:             }
    1658:         }
    1659:
    1660:         // Set the correct dbName
    1661:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1662:
    1663:         $affectedRows = 0; // initialize var to track total num of affected rows
    1664:
    1665:         try {
    1666:             // use transaction because $criteria could contain info
    1667:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1668:             $con->beginTransaction();
    1669:
    1670:             $affectedRows += BasePeer::doDelete($criteria, $con);
    1671:             TaxRuleCountryPeer::clearRelatedInstancePool();
    1672:             $con->commit();
    1673:
    1674:             return $affectedRows;
    1675:         } catch (PropelException $e) {
    1676:             $con->rollBack();
    1677:             throw $e;
    1678:         }
    1679:     }
    1680:
    1681:     /**
    1682:      * Validates all modified columns of given TaxRuleCountry object.
    1683:      * If parameter $columns is either a single column name or an array of column names
    1684:      * than only those columns are validated.
    1685:      *
    1686:      * NOTICE: This does not apply to primary or foreign keys for now.
    1687:      *
    1688:      * @param      TaxRuleCountry $obj The object to validate.
    1689:      * @param      mixed $cols Column name or array of column names.
    1690:      *
    1691:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
    1692:      */
    1693:     public static function doValidate($obj, $cols = null)
    1694:     {
    1695:         $columns = array();
    1696:
    1697:         if ($cols) {
    1698:             $dbMap = Propel::getDatabaseMap(TaxRuleCountryPeer::DATABASE_NAME);
    1699:             $tableMap = $dbMap->getTable(TaxRuleCountryPeer::TABLE_NAME);
    1700:
    1701:             if (! is_array($cols)) {
    1702:                 $cols = array($cols);
    1703:             }
    1704:
    1705:             foreach ($cols as $colName) {
    1706:                 if ($tableMap->hasColumn($colName)) {
    1707:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
    1708:                     $columns[$colName] = $obj->$get();
    1709:                 }
    1710:             }
    1711:         } else {
    1712:
    1713:         }
    1714:
    1715:         return BasePeer::doValidate(TaxRuleCountryPeer::DATABASE_NAME, TaxRuleCountryPeer::TABLE_NAME, $columns);
    1716:     }
    1717:
    1718:     /**
    1719:      * Retrieve a single object by pkey.
    1720:      *
    1721:      * @param      int $pk the primary key.
    1722:      * @param      PropelPDO $con the connection to use
    1723:      * @return TaxRuleCountry
    1724:      */
    1725:     public static function retrieveByPK($pk, PropelPDO $con = null)
    1726:     {
    1727:
    1728:         if (null !== ($obj = TaxRuleCountryPeer::getInstanceFromPool((string) $pk))) {
    1729:             return $obj;
    1730:         }
    1731:
    1732:         if ($con === null) {
    1733:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1734:         }
    1735:
    1736:         $criteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1737:         $criteria->add(TaxRuleCountryPeer::ID, $pk);
    1738:
    1739:         $v = TaxRuleCountryPeer::doSelect($criteria, $con);
    1740:
    1741:         return !empty($v) > 0 ? $v[0] : null;
    1742:     }
    1743:
    1744:     /**
    1745:      * Retrieve multiple objects by pkey.
    1746:      *
    1747:      * @param      array $pks List of primary keys
    1748:      * @param      PropelPDO $con the connection to use
    1749:      * @return TaxRuleCountry[]
    1750:      * @throws PropelException Any exceptions caught during processing will be
    1751:      *       rethrown wrapped into a PropelException.
    1752:      */
    1753:     public static function retrieveByPKs($pks, PropelPDO $con = null)
    1754:     {
    1755:         if ($con === null) {
    1756:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1757:         }
    1758:
    1759:         $objs = null;
    1760:         if (empty($pks)) {
    1761:             $objs = array();
    1762:         } else {
    1763:             $criteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1764:             $criteria->add(TaxRuleCountryPeer::ID, $pks, Criteria::IN);
    1765:             $objs = TaxRuleCountryPeer::doSelect($criteria, $con);
    1766:         }
    1767:
    1768:         return $objs;
    1769:     }
    1770:
    1771: } // BaseTaxRuleCountryPeer
    1772:
    1773: // This is the static code needed to register the TableMap for this table with the main Propel class.
    1774: //
    1775: BaseTaxRuleCountryPeer::buildTableMap();
    1776:
    1777: