# File core/lib/Thelia/Model/om/BaseTaxRuleCountryPeer.php | thelia

       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 durirectly (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()
     388:     {
     389:         TaxRuleCountryPeer::$instances = array();
     390:     }
     391:
     392:     /**
     393:      * Method to invalidate the instance pool of all tables related to tax_rule_country
     394:      * by a foreign key with ON DELETE CASCADE
     395:      */
     396:     public static function clearRelatedInstancePool()
     397:     {
     398:     }
     399:
     400:     /**
     401:      * 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.
     402:      *
     403:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     404:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     405:      *
     406:      * @param      array $row PropelPDO resultset row.
     407:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     408:      * @return string A string version of PK or null if the components of primary key in result array are all null.
     409:      */
     410:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
     411:     {
     412:         // If the PK cannot be derived from the row, return null.
     413:         if ($row[$startcol] === null) {
     414:             return null;
     415:         }
     416:
     417:         return (string) $row[$startcol];
     418:     }
     419:
     420:     /**
     421:      * Retrieves the primary key from the DB resultset row
     422:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     423:      * a multi-column primary key, an array of the primary key columns will be returned.
     424:      *
     425:      * @param      array $row PropelPDO resultset row.
     426:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     427:      * @return mixed The primary key of the row
     428:      */
     429:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
     430:     {
     431:
     432:         return (int) $row[$startcol];
     433:     }
     434:
     435:     /**
     436:      * The returned array will contain objects of the default type or
     437:      * objects that inherit from the default.
     438:      *
     439:      * @throws PropelException Any exceptions caught during processing will be
     440:      *       rethrown wrapped into a PropelException.
     441:      */
     442:     public static function populateObjects(PDOStatement $stmt)
     443:     {
     444:         $results = array();
     445:
     446:         // set the class once to avoid overhead in the loop
     447:         $cls = TaxRuleCountryPeer::getOMClass();
     448:         // populate the object(s)
     449:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     450:             $key = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     451:             if (null !== ($obj = TaxRuleCountryPeer::getInstanceFromPool($key))) {
     452:                 // We no longer rehydrate the object, since this can cause data loss.
     453:                 // See http://www.propelorm.org/ticket/509
     454:                 // $obj->hydrate($row, 0, true); // rehydrate
     455:                 $results[] = $obj;
     456:             } else {
     457:                 $obj = new $cls();
     458:                 $obj->hydrate($row);
     459:                 $results[] = $obj;
     460:                 TaxRuleCountryPeer::addInstanceToPool($obj, $key);
     461:             } // if key exists
     462:         }
     463:         $stmt->closeCursor();
     464:
     465:         return $results;
     466:     }
     467:     /**
     468:      * Populates an object of the default type or an object that inherit from the default.
     469:      *
     470:      * @param      array $row PropelPDO resultset row.
     471:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     472:      * @throws PropelException Any exceptions caught during processing will be
     473:      *       rethrown wrapped into a PropelException.
     474:      * @return array (TaxRuleCountry object, last column rank)
     475:      */
     476:     public static function populateObject($row, $startcol = 0)
     477:     {
     478:         $key = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, $startcol);
     479:         if (null !== ($obj = TaxRuleCountryPeer::getInstanceFromPool($key))) {
     480:             // We no longer rehydrate the object, since this can cause data loss.
     481:             // See http://www.propelorm.org/ticket/509
     482:             // $obj->hydrate($row, $startcol, true); // rehydrate
     483:             $col = $startcol + TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     484:         } else {
     485:             $cls = TaxRuleCountryPeer::OM_CLASS;
     486:             $obj = new $cls();
     487:             $col = $obj->hydrate($row, $startcol);
     488:             TaxRuleCountryPeer::addInstanceToPool($obj, $key);
     489:         }
     490:
     491:         return array($obj, $col);
     492:     }
     493:
     494:
     495:     /**
     496:      * Returns the number of rows matching criteria, joining the related Tax table
     497:      *
     498:      * @param      Criteria $criteria
     499:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     500:      * @param      PropelPDO $con
     501:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     502:      * @return int Number of matching rows.
     503:      */
     504:     public static function doCountJoinTax(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     505:     {
     506:         // we're going to modify criteria, so copy it first
     507:         $criteria = clone $criteria;
     508:
     509:         // We need to set the primary table name, since in the case that there are no WHERE columns
     510:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     511:         // tables go into the FROM clause.
     512:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     513:
     514:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     515:             $criteria->setDistinct();
     516:         }
     517:
     518:         if (!$criteria->hasSelectClause()) {
     519:             TaxRuleCountryPeer::addSelectColumns($criteria);
     520:         }
     521:
     522:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     523:
     524:         // Set the correct dbName
     525:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     526:
     527:         if ($con === null) {
     528:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     529:         }
     530:
     531:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     532:
     533:         $stmt = BasePeer::doCount($criteria, $con);
     534:
     535:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     536:             $count = (int) $row[0];
     537:         } else {
     538:             $count = 0; // no rows returned; we infer that means 0 matches.
     539:         }
     540:         $stmt->closeCursor();
     541:
     542:         return $count;
     543:     }
     544:
     545:
     546:     /**
     547:      * Returns the number of rows matching criteria, joining the related TaxRule table
     548:      *
     549:      * @param      Criteria $criteria
     550:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     551:      * @param      PropelPDO $con
     552:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     553:      * @return int Number of matching rows.
     554:      */
     555:     public static function doCountJoinTaxRule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     556:     {
     557:         // we're going to modify criteria, so copy it first
     558:         $criteria = clone $criteria;
     559:
     560:         // We need to set the primary table name, since in the case that there are no WHERE columns
     561:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     562:         // tables go into the FROM clause.
     563:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     564:
     565:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     566:             $criteria->setDistinct();
     567:         }
     568:
     569:         if (!$criteria->hasSelectClause()) {
     570:             TaxRuleCountryPeer::addSelectColumns($criteria);
     571:         }
     572:
     573:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     574:
     575:         // Set the correct dbName
     576:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     577:
     578:         if ($con === null) {
     579:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     580:         }
     581:
     582:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     583:
     584:         $stmt = BasePeer::doCount($criteria, $con);
     585:
     586:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     587:             $count = (int) $row[0];
     588:         } else {
     589:             $count = 0; // no rows returned; we infer that means 0 matches.
     590:         }
     591:         $stmt->closeCursor();
     592:
     593:         return $count;
     594:     }
     595:
     596:
     597:     /**
     598:      * Returns the number of rows matching criteria, joining the related Country table
     599:      *
     600:      * @param      Criteria $criteria
     601:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     602:      * @param      PropelPDO $con
     603:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     604:      * @return int Number of matching rows.
     605:      */
     606:     public static function doCountJoinCountry(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     607:     {
     608:         // we're going to modify criteria, so copy it first
     609:         $criteria = clone $criteria;
     610:
     611:         // We need to set the primary table name, since in the case that there are no WHERE columns
     612:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     613:         // tables go into the FROM clause.
     614:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     615:
     616:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     617:             $criteria->setDistinct();
     618:         }
     619:
     620:         if (!$criteria->hasSelectClause()) {
     621:             TaxRuleCountryPeer::addSelectColumns($criteria);
     622:         }
     623:
     624:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     625:
     626:         // Set the correct dbName
     627:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     628:
     629:         if ($con === null) {
     630:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     631:         }
     632:
     633:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     634:
     635:         $stmt = BasePeer::doCount($criteria, $con);
     636:
     637:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     638:             $count = (int) $row[0];
     639:         } else {
     640:             $count = 0; // no rows returned; we infer that means 0 matches.
     641:         }
     642:         $stmt->closeCursor();
     643:
     644:         return $count;
     645:     }
     646:
     647:
     648:     /**
     649:      * Selects a collection of TaxRuleCountry objects pre-filled with their Tax objects.
     650:      * @param      Criteria  $criteria
     651:      * @param      PropelPDO $con
     652:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     653:      * @return array           Array of TaxRuleCountry objects.
     654:      * @throws PropelException Any exceptions caught during processing will be
     655:      *       rethrown wrapped into a PropelException.
     656:      */
     657:     public static function doSelectJoinTax(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     658:     {
     659:         $criteria = clone $criteria;
     660:
     661:         // Set the correct dbName if it has not been overridden
     662:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     663:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     664:         }
     665:
     666:         TaxRuleCountryPeer::addSelectColumns($criteria);
     667:         $startcol = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     668:         TaxPeer::addSelectColumns($criteria);
     669:
     670:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     671:
     672:         $stmt = BasePeer::doSelect($criteria, $con);
     673:         $results = array();
     674:
     675:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     676:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     677:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     678:                 // We no longer rehydrate the object, since this can cause data loss.
     679:                 // See http://www.propelorm.org/ticket/509
     680:                 // $obj1->hydrate($row, 0, true); // rehydrate
     681:             } else {
     682:
     683:                 $cls = TaxRuleCountryPeer::getOMClass();
     684:
     685:                 $obj1 = new $cls();
     686:                 $obj1->hydrate($row);
     687:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     688:             } // if $obj1 already loaded
     689:
     690:             $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol);
     691:             if ($key2 !== null) {
     692:                 $obj2 = TaxPeer::getInstanceFromPool($key2);
     693:                 if (!$obj2) {
     694:
     695:                     $cls = TaxPeer::getOMClass();
     696:
     697:                     $obj2 = new $cls();
     698:                     $obj2->hydrate($row, $startcol);
     699:                     TaxPeer::addInstanceToPool($obj2, $key2);
     700:                 } // if obj2 already loaded
     701:
     702:                 // Add the $obj1 (TaxRuleCountry) to $obj2 (Tax)
     703:                 $obj2->addTaxRuleCountry($obj1);
     704:
     705:             } // if joined row was not null
     706:
     707:             $results[] = $obj1;
     708:         }
     709:         $stmt->closeCursor();
     710:
     711:         return $results;
     712:     }
     713:
     714:
     715:     /**
     716:      * Selects a collection of TaxRuleCountry objects pre-filled with their TaxRule objects.
     717:      * @param      Criteria  $criteria
     718:      * @param      PropelPDO $con
     719:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     720:      * @return array           Array of TaxRuleCountry objects.
     721:      * @throws PropelException Any exceptions caught during processing will be
     722:      *       rethrown wrapped into a PropelException.
     723:      */
     724:     public static function doSelectJoinTaxRule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     725:     {
     726:         $criteria = clone $criteria;
     727:
     728:         // Set the correct dbName if it has not been overridden
     729:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     730:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     731:         }
     732:
     733:         TaxRuleCountryPeer::addSelectColumns($criteria);
     734:         $startcol = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     735:         TaxRulePeer::addSelectColumns($criteria);
     736:
     737:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     738:
     739:         $stmt = BasePeer::doSelect($criteria, $con);
     740:         $results = array();
     741:
     742:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     743:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     744:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     745:                 // We no longer rehydrate the object, since this can cause data loss.
     746:                 // See http://www.propelorm.org/ticket/509
     747:                 // $obj1->hydrate($row, 0, true); // rehydrate
     748:             } else {
     749:
     750:                 $cls = TaxRuleCountryPeer::getOMClass();
     751:
     752:                 $obj1 = new $cls();
     753:                 $obj1->hydrate($row);
     754:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     755:             } // if $obj1 already loaded
     756:
     757:             $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol);
     758:             if ($key2 !== null) {
     759:                 $obj2 = TaxRulePeer::getInstanceFromPool($key2);
     760:                 if (!$obj2) {
     761:
     762:                     $cls = TaxRulePeer::getOMClass();
     763:
     764:                     $obj2 = new $cls();
     765:                     $obj2->hydrate($row, $startcol);
     766:                     TaxRulePeer::addInstanceToPool($obj2, $key2);
     767:                 } // if obj2 already loaded
     768:
     769:                 // Add the $obj1 (TaxRuleCountry) to $obj2 (TaxRule)
     770:                 $obj2->addTaxRuleCountry($obj1);
     771:
     772:             } // if joined row was not null
     773:
     774:             $results[] = $obj1;
     775:         }
     776:         $stmt->closeCursor();
     777:
     778:         return $results;
     779:     }
     780:
     781:
     782:     /**
     783:      * Selects a collection of TaxRuleCountry objects pre-filled with their Country objects.
     784:      * @param      Criteria  $criteria
     785:      * @param      PropelPDO $con
     786:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     787:      * @return array           Array of TaxRuleCountry objects.
     788:      * @throws PropelException Any exceptions caught during processing will be
     789:      *       rethrown wrapped into a PropelException.
     790:      */
     791:     public static function doSelectJoinCountry(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     792:     {
     793:         $criteria = clone $criteria;
     794:
     795:         // Set the correct dbName if it has not been overridden
     796:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     797:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     798:         }
     799:
     800:         TaxRuleCountryPeer::addSelectColumns($criteria);
     801:         $startcol = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     802:         CountryPeer::addSelectColumns($criteria);
     803:
     804:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     805:
     806:         $stmt = BasePeer::doSelect($criteria, $con);
     807:         $results = array();
     808:
     809:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     810:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     811:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     812:                 // We no longer rehydrate the object, since this can cause data loss.
     813:                 // See http://www.propelorm.org/ticket/509
     814:                 // $obj1->hydrate($row, 0, true); // rehydrate
     815:             } else {
     816:
     817:                 $cls = TaxRuleCountryPeer::getOMClass();
     818:
     819:                 $obj1 = new $cls();
     820:                 $obj1->hydrate($row);
     821:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     822:             } // if $obj1 already loaded
     823:
     824:             $key2 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol);
     825:             if ($key2 !== null) {
     826:                 $obj2 = CountryPeer::getInstanceFromPool($key2);
     827:                 if (!$obj2) {
     828:
     829:                     $cls = CountryPeer::getOMClass();
     830:
     831:                     $obj2 = new $cls();
     832:                     $obj2->hydrate($row, $startcol);
     833:                     CountryPeer::addInstanceToPool($obj2, $key2);
     834:                 } // if obj2 already loaded
     835:
     836:                 // Add the $obj1 (TaxRuleCountry) to $obj2 (Country)
     837:                 $obj2->addTaxRuleCountry($obj1);
     838:
     839:             } // if joined row was not null
     840:
     841:             $results[] = $obj1;
     842:         }
     843:         $stmt->closeCursor();
     844:
     845:         return $results;
     846:     }
     847:
     848:
     849:     /**
     850:      * Returns the number of rows matching criteria, joining all related tables
     851:      *
     852:      * @param      Criteria $criteria
     853:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     854:      * @param      PropelPDO $con
     855:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     856:      * @return int Number of matching rows.
     857:      */
     858:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     859:     {
     860:         // we're going to modify criteria, so copy it first
     861:         $criteria = clone $criteria;
     862:
     863:         // We need to set the primary table name, since in the case that there are no WHERE columns
     864:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     865:         // tables go into the FROM clause.
     866:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
     867:
     868:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     869:             $criteria->setDistinct();
     870:         }
     871:
     872:         if (!$criteria->hasSelectClause()) {
     873:             TaxRuleCountryPeer::addSelectColumns($criteria);
     874:         }
     875:
     876:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     877:
     878:         // Set the correct dbName
     879:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     880:
     881:         if ($con === null) {
     882:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     883:         }
     884:
     885:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     886:
     887:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     888:
     889:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     890:
     891:         $stmt = BasePeer::doCount($criteria, $con);
     892:
     893:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     894:             $count = (int) $row[0];
     895:         } else {
     896:             $count = 0; // no rows returned; we infer that means 0 matches.
     897:         }
     898:         $stmt->closeCursor();
     899:
     900:         return $count;
     901:     }
     902:
     903:     /**
     904:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects.
     905:      *
     906:      * @param      Criteria  $criteria
     907:      * @param      PropelPDO $con
     908:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     909:      * @return array           Array of TaxRuleCountry objects.
     910:      * @throws PropelException Any exceptions caught during processing will be
     911:      *       rethrown wrapped into a PropelException.
     912:      */
     913:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     914:     {
     915:         $criteria = clone $criteria;
     916:
     917:         // Set the correct dbName if it has not been overridden
     918:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     919:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
     920:         }
     921:
     922:         TaxRuleCountryPeer::addSelectColumns($criteria);
     923:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
     924:
     925:         TaxPeer::addSelectColumns($criteria);
     926:         $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS;
     927:
     928:         TaxRulePeer::addSelectColumns($criteria);
     929:         $startcol4 = $startcol3 + TaxRulePeer::NUM_HYDRATE_COLUMNS;
     930:
     931:         CountryPeer::addSelectColumns($criteria);
     932:         $startcol5 = $startcol4 + CountryPeer::NUM_HYDRATE_COLUMNS;
     933:
     934:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
     935:
     936:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
     937:
     938:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
     939:
     940:         $stmt = BasePeer::doSelect($criteria, $con);
     941:         $results = array();
     942:
     943:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     944:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
     945:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
     946:                 // We no longer rehydrate the object, since this can cause data loss.
     947:                 // See http://www.propelorm.org/ticket/509
     948:                 // $obj1->hydrate($row, 0, true); // rehydrate
     949:             } else {
     950:                 $cls = TaxRuleCountryPeer::getOMClass();
     951:
     952:                 $obj1 = new $cls();
     953:                 $obj1->hydrate($row);
     954:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
     955:             } // if obj1 already loaded
     956:
     957:             // Add objects for joined Tax rows
     958:
     959:             $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2);
     960:             if ($key2 !== null) {
     961:                 $obj2 = TaxPeer::getInstanceFromPool($key2);
     962:                 if (!$obj2) {
     963:
     964:                     $cls = TaxPeer::getOMClass();
     965:
     966:                     $obj2 = new $cls();
     967:                     $obj2->hydrate($row, $startcol2);
     968:                     TaxPeer::addInstanceToPool($obj2, $key2);
     969:                 } // if obj2 loaded
     970:
     971:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (Tax)
     972:                 $obj2->addTaxRuleCountry($obj1);
     973:             } // if joined row not null
     974:
     975:             // Add objects for joined TaxRule rows
     976:
     977:             $key3 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol3);
     978:             if ($key3 !== null) {
     979:                 $obj3 = TaxRulePeer::getInstanceFromPool($key3);
     980:                 if (!$obj3) {
     981:
     982:                     $cls = TaxRulePeer::getOMClass();
     983:
     984:                     $obj3 = new $cls();
     985:                     $obj3->hydrate($row, $startcol3);
     986:                     TaxRulePeer::addInstanceToPool($obj3, $key3);
     987:                 } // if obj3 loaded
     988:
     989:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (TaxRule)
     990:                 $obj3->addTaxRuleCountry($obj1);
     991:             } // if joined row not null
     992:
     993:             // Add objects for joined Country rows
     994:
     995:             $key4 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol4);
     996:             if ($key4 !== null) {
     997:                 $obj4 = CountryPeer::getInstanceFromPool($key4);
     998:                 if (!$obj4) {
     999:
    1000:                     $cls = CountryPeer::getOMClass();
    1001:
    1002:                     $obj4 = new $cls();
    1003:                     $obj4->hydrate($row, $startcol4);
    1004:                     CountryPeer::addInstanceToPool($obj4, $key4);
    1005:                 } // if obj4 loaded
    1006:
    1007:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj4 (Country)
    1008:                 $obj4->addTaxRuleCountry($obj1);
    1009:             } // if joined row not null
    1010:
    1011:             $results[] = $obj1;
    1012:         }
    1013:         $stmt->closeCursor();
    1014:
    1015:         return $results;
    1016:     }
    1017:
    1018:
    1019:     /**
    1020:      * Returns the number of rows matching criteria, joining the related Tax table
    1021:      *
    1022:      * @param      Criteria $criteria
    1023:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1024:      * @param      PropelPDO $con
    1025:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1026:      * @return int Number of matching rows.
    1027:      */
    1028:     public static function doCountJoinAllExceptTax(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1029:     {
    1030:         // we're going to modify criteria, so copy it first
    1031:         $criteria = clone $criteria;
    1032:
    1033:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1034:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1035:         // tables go into the FROM clause.
    1036:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1037:
    1038:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1039:             $criteria->setDistinct();
    1040:         }
    1041:
    1042:         if (!$criteria->hasSelectClause()) {
    1043:             TaxRuleCountryPeer::addSelectColumns($criteria);
    1044:         }
    1045:
    1046:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1047:
    1048:         // Set the correct dbName
    1049:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1050:
    1051:         if ($con === null) {
    1052:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1053:         }
    1054:
    1055:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1056:
    1057:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1058:
    1059:         $stmt = BasePeer::doCount($criteria, $con);
    1060:
    1061:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1062:             $count = (int) $row[0];
    1063:         } else {
    1064:             $count = 0; // no rows returned; we infer that means 0 matches.
    1065:         }
    1066:         $stmt->closeCursor();
    1067:
    1068:         return $count;
    1069:     }
    1070:
    1071:
    1072:     /**
    1073:      * Returns the number of rows matching criteria, joining the related TaxRule table
    1074:      *
    1075:      * @param      Criteria $criteria
    1076:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1077:      * @param      PropelPDO $con
    1078:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1079:      * @return int Number of matching rows.
    1080:      */
    1081:     public static function doCountJoinAllExceptTaxRule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1082:     {
    1083:         // we're going to modify criteria, so copy it first
    1084:         $criteria = clone $criteria;
    1085:
    1086:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1087:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1088:         // tables go into the FROM clause.
    1089:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1090:
    1091:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1092:             $criteria->setDistinct();
    1093:         }
    1094:
    1095:         if (!$criteria->hasSelectClause()) {
    1096:             TaxRuleCountryPeer::addSelectColumns($criteria);
    1097:         }
    1098:
    1099:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1100:
    1101:         // Set the correct dbName
    1102:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1103:
    1104:         if ($con === null) {
    1105:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1106:         }
    1107:
    1108:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1109:
    1110:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1111:
    1112:         $stmt = BasePeer::doCount($criteria, $con);
    1113:
    1114:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1115:             $count = (int) $row[0];
    1116:         } else {
    1117:             $count = 0; // no rows returned; we infer that means 0 matches.
    1118:         }
    1119:         $stmt->closeCursor();
    1120:
    1121:         return $count;
    1122:     }
    1123:
    1124:
    1125:     /**
    1126:      * Returns the number of rows matching criteria, joining the related Country table
    1127:      *
    1128:      * @param      Criteria $criteria
    1129:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1130:      * @param      PropelPDO $con
    1131:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1132:      * @return int Number of matching rows.
    1133:      */
    1134:     public static function doCountJoinAllExceptCountry(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1135:     {
    1136:         // we're going to modify criteria, so copy it first
    1137:         $criteria = clone $criteria;
    1138:
    1139:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1140:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1141:         // tables go into the FROM clause.
    1142:         $criteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1143:
    1144:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1145:             $criteria->setDistinct();
    1146:         }
    1147:
    1148:         if (!$criteria->hasSelectClause()) {
    1149:             TaxRuleCountryPeer::addSelectColumns($criteria);
    1150:         }
    1151:
    1152:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1153:
    1154:         // Set the correct dbName
    1155:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1156:
    1157:         if ($con === null) {
    1158:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1159:         }
    1160:
    1161:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1162:
    1163:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1164:
    1165:         $stmt = BasePeer::doCount($criteria, $con);
    1166:
    1167:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1168:             $count = (int) $row[0];
    1169:         } else {
    1170:             $count = 0; // no rows returned; we infer that means 0 matches.
    1171:         }
    1172:         $stmt->closeCursor();
    1173:
    1174:         return $count;
    1175:     }
    1176:
    1177:
    1178:     /**
    1179:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects except Tax.
    1180:      *
    1181:      * @param      Criteria  $criteria
    1182:      * @param      PropelPDO $con
    1183:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1184:      * @return array           Array of TaxRuleCountry objects.
    1185:      * @throws PropelException Any exceptions caught during processing will be
    1186:      *       rethrown wrapped into a PropelException.
    1187:      */
    1188:     public static function doSelectJoinAllExceptTax(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1189:     {
    1190:         $criteria = clone $criteria;
    1191:
    1192:         // Set the correct dbName if it has not been overridden
    1193:         // $criteria->getDbName() will return the same object if not set to another value
    1194:         // so == check is okay and faster
    1195:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1196:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1197:         }
    1198:
    1199:         TaxRuleCountryPeer::addSelectColumns($criteria);
    1200:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
    1201:
    1202:         TaxRulePeer::addSelectColumns($criteria);
    1203:         $startcol3 = $startcol2 + TaxRulePeer::NUM_HYDRATE_COLUMNS;
    1204:
    1205:         CountryPeer::addSelectColumns($criteria);
    1206:         $startcol4 = $startcol3 + CountryPeer::NUM_HYDRATE_COLUMNS;
    1207:
    1208:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1209:
    1210:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1211:
    1212:
    1213:         $stmt = BasePeer::doSelect($criteria, $con);
    1214:         $results = array();
    1215:
    1216:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1217:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
    1218:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
    1219:                 // We no longer rehydrate the object, since this can cause data loss.
    1220:                 // See http://www.propelorm.org/ticket/509
    1221:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1222:             } else {
    1223:                 $cls = TaxRuleCountryPeer::getOMClass();
    1224:
    1225:                 $obj1 = new $cls();
    1226:                 $obj1->hydrate($row);
    1227:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
    1228:             } // if obj1 already loaded
    1229:
    1230:                 // Add objects for joined TaxRule rows
    1231:
    1232:                 $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1233:                 if ($key2 !== null) {
    1234:                     $obj2 = TaxRulePeer::getInstanceFromPool($key2);
    1235:                     if (!$obj2) {
    1236:
    1237:                         $cls = TaxRulePeer::getOMClass();
    1238:
    1239:                     $obj2 = new $cls();
    1240:                     $obj2->hydrate($row, $startcol2);
    1241:                     TaxRulePeer::addInstanceToPool($obj2, $key2);
    1242:                 } // if $obj2 already loaded
    1243:
    1244:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (TaxRule)
    1245:                 $obj2->addTaxRuleCountry($obj1);
    1246:
    1247:             } // if joined row is not null
    1248:
    1249:                 // Add objects for joined Country rows
    1250:
    1251:                 $key3 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1252:                 if ($key3 !== null) {
    1253:                     $obj3 = CountryPeer::getInstanceFromPool($key3);
    1254:                     if (!$obj3) {
    1255:
    1256:                         $cls = CountryPeer::getOMClass();
    1257:
    1258:                     $obj3 = new $cls();
    1259:                     $obj3->hydrate($row, $startcol3);
    1260:                     CountryPeer::addInstanceToPool($obj3, $key3);
    1261:                 } // if $obj3 already loaded
    1262:
    1263:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (Country)
    1264:                 $obj3->addTaxRuleCountry($obj1);
    1265:
    1266:             } // if joined row is not null
    1267:
    1268:             $results[] = $obj1;
    1269:         }
    1270:         $stmt->closeCursor();
    1271:
    1272:         return $results;
    1273:     }
    1274:
    1275:
    1276:     /**
    1277:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects except TaxRule.
    1278:      *
    1279:      * @param      Criteria  $criteria
    1280:      * @param      PropelPDO $con
    1281:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1282:      * @return array           Array of TaxRuleCountry objects.
    1283:      * @throws PropelException Any exceptions caught during processing will be
    1284:      *       rethrown wrapped into a PropelException.
    1285:      */
    1286:     public static function doSelectJoinAllExceptTaxRule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1287:     {
    1288:         $criteria = clone $criteria;
    1289:
    1290:         // Set the correct dbName if it has not been overridden
    1291:         // $criteria->getDbName() will return the same object if not set to another value
    1292:         // so == check is okay and faster
    1293:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1294:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1295:         }
    1296:
    1297:         TaxRuleCountryPeer::addSelectColumns($criteria);
    1298:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
    1299:
    1300:         TaxPeer::addSelectColumns($criteria);
    1301:         $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS;
    1302:
    1303:         CountryPeer::addSelectColumns($criteria);
    1304:         $startcol4 = $startcol3 + CountryPeer::NUM_HYDRATE_COLUMNS;
    1305:
    1306:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1307:
    1308:         $criteria->addJoin(TaxRuleCountryPeer::COUNTRY_ID, CountryPeer::ID, $join_behavior);
    1309:
    1310:
    1311:         $stmt = BasePeer::doSelect($criteria, $con);
    1312:         $results = array();
    1313:
    1314:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1315:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
    1316:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
    1317:                 // We no longer rehydrate the object, since this can cause data loss.
    1318:                 // See http://www.propelorm.org/ticket/509
    1319:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1320:             } else {
    1321:                 $cls = TaxRuleCountryPeer::getOMClass();
    1322:
    1323:                 $obj1 = new $cls();
    1324:                 $obj1->hydrate($row);
    1325:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
    1326:             } // if obj1 already loaded
    1327:
    1328:                 // Add objects for joined Tax rows
    1329:
    1330:                 $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1331:                 if ($key2 !== null) {
    1332:                     $obj2 = TaxPeer::getInstanceFromPool($key2);
    1333:                     if (!$obj2) {
    1334:
    1335:                         $cls = TaxPeer::getOMClass();
    1336:
    1337:                     $obj2 = new $cls();
    1338:                     $obj2->hydrate($row, $startcol2);
    1339:                     TaxPeer::addInstanceToPool($obj2, $key2);
    1340:                 } // if $obj2 already loaded
    1341:
    1342:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (Tax)
    1343:                 $obj2->addTaxRuleCountry($obj1);
    1344:
    1345:             } // if joined row is not null
    1346:
    1347:                 // Add objects for joined Country rows
    1348:
    1349:                 $key3 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1350:                 if ($key3 !== null) {
    1351:                     $obj3 = CountryPeer::getInstanceFromPool($key3);
    1352:                     if (!$obj3) {
    1353:
    1354:                         $cls = CountryPeer::getOMClass();
    1355:
    1356:                     $obj3 = new $cls();
    1357:                     $obj3->hydrate($row, $startcol3);
    1358:                     CountryPeer::addInstanceToPool($obj3, $key3);
    1359:                 } // if $obj3 already loaded
    1360:
    1361:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (Country)
    1362:                 $obj3->addTaxRuleCountry($obj1);
    1363:
    1364:             } // if joined row is not null
    1365:
    1366:             $results[] = $obj1;
    1367:         }
    1368:         $stmt->closeCursor();
    1369:
    1370:         return $results;
    1371:     }
    1372:
    1373:
    1374:     /**
    1375:      * Selects a collection of TaxRuleCountry objects pre-filled with all related objects except Country.
    1376:      *
    1377:      * @param      Criteria  $criteria
    1378:      * @param      PropelPDO $con
    1379:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1380:      * @return array           Array of TaxRuleCountry objects.
    1381:      * @throws PropelException Any exceptions caught during processing will be
    1382:      *       rethrown wrapped into a PropelException.
    1383:      */
    1384:     public static function doSelectJoinAllExceptCountry(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1385:     {
    1386:         $criteria = clone $criteria;
    1387:
    1388:         // Set the correct dbName if it has not been overridden
    1389:         // $criteria->getDbName() will return the same object if not set to another value
    1390:         // so == check is okay and faster
    1391:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1392:             $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1393:         }
    1394:
    1395:         TaxRuleCountryPeer::addSelectColumns($criteria);
    1396:         $startcol2 = TaxRuleCountryPeer::NUM_HYDRATE_COLUMNS;
    1397:
    1398:         TaxPeer::addSelectColumns($criteria);
    1399:         $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS;
    1400:
    1401:         TaxRulePeer::addSelectColumns($criteria);
    1402:         $startcol4 = $startcol3 + TaxRulePeer::NUM_HYDRATE_COLUMNS;
    1403:
    1404:         $criteria->addJoin(TaxRuleCountryPeer::TAX_ID, TaxPeer::ID, $join_behavior);
    1405:
    1406:         $criteria->addJoin(TaxRuleCountryPeer::TAX_RULE_ID, TaxRulePeer::ID, $join_behavior);
    1407:
    1408:
    1409:         $stmt = BasePeer::doSelect($criteria, $con);
    1410:         $results = array();
    1411:
    1412:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1413:             $key1 = TaxRuleCountryPeer::getPrimaryKeyHashFromRow($row, 0);
    1414:             if (null !== ($obj1 = TaxRuleCountryPeer::getInstanceFromPool($key1))) {
    1415:                 // We no longer rehydrate the object, since this can cause data loss.
    1416:                 // See http://www.propelorm.org/ticket/509
    1417:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1418:             } else {
    1419:                 $cls = TaxRuleCountryPeer::getOMClass();
    1420:
    1421:                 $obj1 = new $cls();
    1422:                 $obj1->hydrate($row);
    1423:                 TaxRuleCountryPeer::addInstanceToPool($obj1, $key1);
    1424:             } // if obj1 already loaded
    1425:
    1426:                 // Add objects for joined Tax rows
    1427:
    1428:                 $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1429:                 if ($key2 !== null) {
    1430:                     $obj2 = TaxPeer::getInstanceFromPool($key2);
    1431:                     if (!$obj2) {
    1432:
    1433:                         $cls = TaxPeer::getOMClass();
    1434:
    1435:                     $obj2 = new $cls();
    1436:                     $obj2->hydrate($row, $startcol2);
    1437:                     TaxPeer::addInstanceToPool($obj2, $key2);
    1438:                 } // if $obj2 already loaded
    1439:
    1440:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj2 (Tax)
    1441:                 $obj2->addTaxRuleCountry($obj1);
    1442:
    1443:             } // if joined row is not null
    1444:
    1445:                 // Add objects for joined TaxRule rows
    1446:
    1447:                 $key3 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1448:                 if ($key3 !== null) {
    1449:                     $obj3 = TaxRulePeer::getInstanceFromPool($key3);
    1450:                     if (!$obj3) {
    1451:
    1452:                         $cls = TaxRulePeer::getOMClass();
    1453:
    1454:                     $obj3 = new $cls();
    1455:                     $obj3->hydrate($row, $startcol3);
    1456:                     TaxRulePeer::addInstanceToPool($obj3, $key3);
    1457:                 } // if $obj3 already loaded
    1458:
    1459:                 // Add the $obj1 (TaxRuleCountry) to the collection in $obj3 (TaxRule)
    1460:                 $obj3->addTaxRuleCountry($obj1);
    1461:
    1462:             } // if joined row is not null
    1463:
    1464:             $results[] = $obj1;
    1465:         }
    1466:         $stmt->closeCursor();
    1467:
    1468:         return $results;
    1469:     }
    1470:
    1471:     /**
    1472:      * Returns the TableMap related to this peer.
    1473:      * This method is not needed for general use but a specific application could have a need.
    1474:      * @return TableMap
    1475:      * @throws PropelException Any exceptions caught during processing will be
    1476:      *       rethrown wrapped into a PropelException.
    1477:      */
    1478:     public static function getTableMap()
    1479:     {
    1480:         return Propel::getDatabaseMap(TaxRuleCountryPeer::DATABASE_NAME)->getTable(TaxRuleCountryPeer::TABLE_NAME);
    1481:     }
    1482:
    1483:     /**
    1484:      * Add a TableMap instance to the database for this peer class.
    1485:      */
    1486:     public static function buildTableMap()
    1487:     {
    1488:       $dbMap = Propel::getDatabaseMap(BaseTaxRuleCountryPeer::DATABASE_NAME);
    1489:       if (!$dbMap->hasTable(BaseTaxRuleCountryPeer::TABLE_NAME)) {
    1490:         $dbMap->addTableObject(new TaxRuleCountryTableMap());
    1491:       }
    1492:     }
    1493:
    1494:     /**
    1495:      * The class that the Peer will make instances of.
    1496:      *
    1497:      *
    1498:      * @return string ClassName
    1499:      */
    1500:     public static function getOMClass()
    1501:     {
    1502:         return TaxRuleCountryPeer::OM_CLASS;
    1503:     }
    1504:
    1505:     /**
    1506:      * Performs an INSERT on the database, given a TaxRuleCountry or Criteria object.
    1507:      *
    1508:      * @param      mixed $values Criteria or TaxRuleCountry object containing data that is used to create the INSERT statement.
    1509:      * @param      PropelPDO $con the PropelPDO connection to use
    1510:      * @return mixed           The new primary key.
    1511:      * @throws PropelException Any exceptions caught during processing will be
    1512:      *       rethrown wrapped into a PropelException.
    1513:      */
    1514:     public static function doInsert($values, PropelPDO $con = null)
    1515:     {
    1516:         if ($con === null) {
    1517:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1518:         }
    1519:
    1520:         if ($values instanceof Criteria) {
    1521:             $criteria = clone $values; // rename for clarity
    1522:         } else {
    1523:             $criteria = $values->buildCriteria(); // build Criteria from TaxRuleCountry object
    1524:         }
    1525:
    1526:
    1527:         // Set the correct dbName
    1528:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1529:
    1530:         try {
    1531:             // use transaction because $criteria could contain info
    1532:             // for more than one table (I guess, conceivably)
    1533:             $con->beginTransaction();
    1534:             $pk = BasePeer::doInsert($criteria, $con);
    1535:             $con->commit();
    1536:         } catch (PropelException $e) {
    1537:             $con->rollBack();
    1538:             throw $e;
    1539:         }
    1540:
    1541:         return $pk;
    1542:     }
    1543:
    1544:     /**
    1545:      * Performs an UPDATE on the database, given a TaxRuleCountry or Criteria object.
    1546:      *
    1547:      * @param      mixed $values Criteria or TaxRuleCountry object containing data that is used to create the UPDATE statement.
    1548:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
    1549:      * @return int             The number of affected rows (if supported by underlying database driver).
    1550:      * @throws PropelException Any exceptions caught during processing will be
    1551:      *       rethrown wrapped into a PropelException.
    1552:      */
    1553:     public static function doUpdate($values, PropelPDO $con = null)
    1554:     {
    1555:         if ($con === null) {
    1556:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1557:         }
    1558:
    1559:         $selectCriteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1560:
    1561:         if ($values instanceof Criteria) {
    1562:             $criteria = clone $values; // rename for clarity
    1563:
    1564:             $comparison = $criteria->getComparison(TaxRuleCountryPeer::ID);
    1565:             $value = $criteria->remove(TaxRuleCountryPeer::ID);
    1566:             if ($value) {
    1567:                 $selectCriteria->add(TaxRuleCountryPeer::ID, $value, $comparison);
    1568:             } else {
    1569:                 $selectCriteria->setPrimaryTableName(TaxRuleCountryPeer::TABLE_NAME);
    1570:             }
    1571:
    1572:         } else { // $values is TaxRuleCountry object
    1573:             $criteria = $values->buildCriteria(); // gets full criteria
    1574:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
    1575:         }
    1576:
    1577:         // set the correct dbName
    1578:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1579:
    1580:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
    1581:     }
    1582:
    1583:     /**
    1584:      * Deletes all rows from the tax_rule_country table.
    1585:      *
    1586:      * @param      PropelPDO $con the connection to use
    1587:      * @return int             The number of affected rows (if supported by underlying database driver).
    1588:      * @throws PropelException
    1589:      */
    1590:     public static function doDeleteAll(PropelPDO $con = null)
    1591:     {
    1592:         if ($con === null) {
    1593:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1594:         }
    1595:         $affectedRows = 0; // initialize var to track total num of affected rows
    1596:         try {
    1597:             // use transaction because $criteria could contain info
    1598:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1599:             $con->beginTransaction();
    1600:             $affectedRows += BasePeer::doDeleteAll(TaxRuleCountryPeer::TABLE_NAME, $con, TaxRuleCountryPeer::DATABASE_NAME);
    1601:             // Because this db requires some delete cascade/set null emulation, we have to
    1602:             // clear the cached instance *after* the emulation has happened (since
    1603:             // instances get re-added by the select statement contained therein).
    1604:             TaxRuleCountryPeer::clearInstancePool();
    1605:             TaxRuleCountryPeer::clearRelatedInstancePool();
    1606:             $con->commit();
    1607:
    1608:             return $affectedRows;
    1609:         } catch (PropelException $e) {
    1610:             $con->rollBack();
    1611:             throw $e;
    1612:         }
    1613:     }
    1614:
    1615:     /**
    1616:      * Performs a DELETE on the database, given a TaxRuleCountry or Criteria object OR a primary key value.
    1617:      *
    1618:      * @param      mixed $values Criteria or TaxRuleCountry object or primary key or array of primary keys
    1619:      *              which is used to create the DELETE statement
    1620:      * @param      PropelPDO $con the connection to use
    1621:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
    1622:      *              if supported by native driver or if emulated using Propel.
    1623:      * @throws PropelException Any exceptions caught during processing will be
    1624:      *       rethrown wrapped into a PropelException.
    1625:      */
    1626:      public static function doDelete($values, PropelPDO $con = null)
    1627:      {
    1628:         if ($con === null) {
    1629:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1630:         }
    1631:
    1632:         if ($values instanceof Criteria) {
    1633:             // invalidate the cache for all objects of this type, since we have no
    1634:             // way of knowing (without running a query) what objects should be invalidated
    1635:             // from the cache based on this Criteria.
    1636:             TaxRuleCountryPeer::clearInstancePool();
    1637:             // rename for clarity
    1638:             $criteria = clone $values;
    1639:         } elseif ($values instanceof TaxRuleCountry) { // it's a model object
    1640:             // invalidate the cache for this single object
    1641:             TaxRuleCountryPeer::removeInstanceFromPool($values);
    1642:             // create criteria based on pk values
    1643:             $criteria = $values->buildPkeyCriteria();
    1644:         } else { // it's a primary key, or an array of pks
    1645:             $criteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1646:             $criteria->add(TaxRuleCountryPeer::ID, (array) $values, Criteria::IN);
    1647:             // invalidate the cache for this object(s)
    1648:             foreach ((array) $values as $singleval) {
    1649:                 TaxRuleCountryPeer::removeInstanceFromPool($singleval);
    1650:             }
    1651:         }
    1652:
    1653:         // Set the correct dbName
    1654:         $criteria->setDbName(TaxRuleCountryPeer::DATABASE_NAME);
    1655:
    1656:         $affectedRows = 0; // initialize var to track total num of affected rows
    1657:
    1658:         try {
    1659:             // use transaction because $criteria could contain info
    1660:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1661:             $con->beginTransaction();
    1662:
    1663:             $affectedRows += BasePeer::doDelete($criteria, $con);
    1664:             TaxRuleCountryPeer::clearRelatedInstancePool();
    1665:             $con->commit();
    1666:
    1667:             return $affectedRows;
    1668:         } catch (PropelException $e) {
    1669:             $con->rollBack();
    1670:             throw $e;
    1671:         }
    1672:     }
    1673:
    1674:     /**
    1675:      * Validates all modified columns of given TaxRuleCountry object.
    1676:      * If parameter $columns is either a single column name or an array of column names
    1677:      * than only those columns are validated.
    1678:      *
    1679:      * NOTICE: This does not apply to primary or foreign keys for now.
    1680:      *
    1681:      * @param      TaxRuleCountry $obj The object to validate.
    1682:      * @param      mixed $cols Column name or array of column names.
    1683:      *
    1684:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
    1685:      */
    1686:     public static function doValidate($obj, $cols = null)
    1687:     {
    1688:         $columns = array();
    1689:
    1690:         if ($cols) {
    1691:             $dbMap = Propel::getDatabaseMap(TaxRuleCountryPeer::DATABASE_NAME);
    1692:             $tableMap = $dbMap->getTable(TaxRuleCountryPeer::TABLE_NAME);
    1693:
    1694:             if (! is_array($cols)) {
    1695:                 $cols = array($cols);
    1696:             }
    1697:
    1698:             foreach ($cols as $colName) {
    1699:                 if ($tableMap->hasColumn($colName)) {
    1700:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
    1701:                     $columns[$colName] = $obj->$get();
    1702:                 }
    1703:             }
    1704:         } else {
    1705:
    1706:         }
    1707:
    1708:         return BasePeer::doValidate(TaxRuleCountryPeer::DATABASE_NAME, TaxRuleCountryPeer::TABLE_NAME, $columns);
    1709:     }
    1710:
    1711:     /**
    1712:      * Retrieve a single object by pkey.
    1713:      *
    1714:      * @param      int $pk the primary key.
    1715:      * @param      PropelPDO $con the connection to use
    1716:      * @return TaxRuleCountry
    1717:      */
    1718:     public static function retrieveByPK($pk, PropelPDO $con = null)
    1719:     {
    1720:
    1721:         if (null !== ($obj = TaxRuleCountryPeer::getInstanceFromPool((string) $pk))) {
    1722:             return $obj;
    1723:         }
    1724:
    1725:         if ($con === null) {
    1726:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1727:         }
    1728:
    1729:         $criteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1730:         $criteria->add(TaxRuleCountryPeer::ID, $pk);
    1731:
    1732:         $v = TaxRuleCountryPeer::doSelect($criteria, $con);
    1733:
    1734:         return !empty($v) > 0 ? $v[0] : null;
    1735:     }
    1736:
    1737:     /**
    1738:      * Retrieve multiple objects by pkey.
    1739:      *
    1740:      * @param      array $pks List of primary keys
    1741:      * @param      PropelPDO $con the connection to use
    1742:      * @return TaxRuleCountry[]
    1743:      * @throws PropelException Any exceptions caught during processing will be
    1744:      *       rethrown wrapped into a PropelException.
    1745:      */
    1746:     public static function retrieveByPKs($pks, PropelPDO $con = null)
    1747:     {
    1748:         if ($con === null) {
    1749:             $con = Propel::getConnection(TaxRuleCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1750:         }
    1751:
    1752:         $objs = null;
    1753:         if (empty($pks)) {
    1754:             $objs = array();
    1755:         } else {
    1756:             $criteria = new Criteria(TaxRuleCountryPeer::DATABASE_NAME);
    1757:             $criteria->add(TaxRuleCountryPeer::ID, $pks, Criteria::IN);
    1758:             $objs = TaxRuleCountryPeer::doSelect($criteria, $con);
    1759:         }
    1760:
    1761:         return $objs;
    1762:     }
    1763:
    1764: } // BaseTaxRuleCountryPeer
    1765:
    1766: // This is the static code needed to register the TableMap for this table with the main Propel class.
    1767: //
    1768: BaseTaxRuleCountryPeer::buildTableMap();
    1769:
    1770: