lib-model-om
[ class tree: lib-model-om ] [ index: lib-model-om ] [ all elements ]

Source for file BaseEtvaVncTokenPeer.php

Documentation is available at BaseEtvaVncTokenPeer.php

  1. <?php
  2.  
  3. /**
  4.  * Base static class for performing query and update operations on the 'vnc_token' table.
  5.  *
  6.  * 
  7.  *
  8.  * This class was autogenerated by Propel 1.3.0-dev on:
  9.  *
  10.  * Thu Jun 18 14:28:38 2009
  11.  *
  12.  * @package    lib.model.om
  13.  */
  14. abstract class BaseEtvaVncTokenPeer {
  15.  
  16.     /** the default database name for this class */
  17.     const DATABASE_NAME 'propel';
  18.  
  19.     /** the table name for this class */
  20.     const TABLE_NAME 'vnc_token';
  21.  
  22.     /** A class that can be returned by this peer. */
  23.     const CLASS_DEFAULT 'lib.model.EtvaVncToken';
  24.  
  25.     /** The total number of columns. */
  26.     const NUM_COLUMNS 5;
  27.  
  28.     /** The number of lazy-loaded columns. */
  29.     const NUM_LAZY_LOAD_COLUMNS 0;
  30.  
  31.     /** the column name for the USERNAME field */
  32.     const USERNAME 'vnc_token.USERNAME';
  33.  
  34.     /** the column name for the TOKEN field */
  35.     const TOKEN 'vnc_token.TOKEN';
  36.  
  37.     /** the column name for the ENCTOKEN field */
  38.     const ENCTOKEN 'vnc_token.ENCTOKEN';
  39.  
  40.     /** the column name for the USER_ID field */
  41.     const USER_ID 'vnc_token.USER_ID';
  42.  
  43.     /** the column name for the CREATED_AT field */
  44.     const CREATED_AT 'vnc_token.CREATED_AT';
  45.  
  46.     /**
  47.      * An identiy map to hold any loaded instances of EtvaVncToken objects.
  48.      * This must be public so that other peer classes can access this when hydrating from JOIN
  49.      * queries.
  50.      * @var        array EtvaVncToken[]
  51.      */
  52.     public static $instances array();
  53.  
  54.     /**
  55.      * The MapBuilder instance for this peer.
  56.      * @var        MapBuilder 
  57.      */
  58.     private static $mapBuilder null;
  59.  
  60.     /**
  61.      * holds an array of fieldnames
  62.      *
  63.      * first dimension keys are the type constants
  64.      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  65.      */
  66.     private static $fieldNames array (
  67.         BasePeer::TYPE_PHPNAME => array ('Username''Token''Enctoken''UserId''CreatedAt'),
  68.         BasePeer::TYPE_STUDLYPHPNAME => array ('username''token''enctoken''userId''createdAt'),
  69.         BasePeer::TYPE_COLNAME => array (self::USERNAMEself::TOKENself::ENCTOKENself::USER_IDself::CREATED_AT),
  70.         BasePeer::TYPE_FIELDNAME => array ('username''token''enctoken''user_id''created_at'),
  71.         BasePeer::TYPE_NUM => array (01234)
  72.     );
  73.  
  74.     /**
  75.      * holds an array of keys for quick access to the fieldnames array
  76.      *
  77.      * first dimension keys are the type constants
  78.      * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  79.      */
  80.     private static $fieldKeys array (
  81.         BasePeer::TYPE_PHPNAME => array ('Username' => 0'Token' => 1'Enctoken' => 2'UserId' => 3'CreatedAt' => 4),
  82.         BasePeer::TYPE_STUDLYPHPNAME => array ('username' => 0'token' => 1'enctoken' => 2'userId' => 3'createdAt' => 4),
  83.         BasePeer::TYPE_COLNAME => array (self::USERNAME => 0self::TOKEN => 1self::ENCTOKEN => 2self::USER_ID => 3self::CREATED_AT => 4),
  84.         BasePeer::TYPE_FIELDNAME => array ('username' => 0'token' => 1'enctoken' => 2'user_id' => 3'created_at' => 4),
  85.         BasePeer::TYPE_NUM => array (01234)
  86.     );
  87.  
  88.     /**
  89.      * Get a (singleton) instance of the MapBuilder for this peer class.
  90.      * @return     MapBuilder The map builder for this peer
  91.      */
  92.     public static function getMapBuilder()
  93.     {
  94.         if (self::$mapBuilder === null{
  95.             self::$mapBuilder new EtvaVncTokenMapBuilder();
  96.         }
  97.         return self::$mapBuilder;
  98.     }
  99.     /**
  100.      * Translates a fieldname to another type
  101.      *
  102.      * @param      string $name field name
  103.      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  104.      *                          BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  105.      * @param      string $toType   One of the class type constants
  106.      * @return     string translated name of the field.
  107.      * @throws     PropelException - if the specified name could not be found in the fieldname mappings.
  108.      */
  109.     static public function translateFieldName($name$fromType$toType)
  110.     {
  111.         $toNames self::getFieldNames($toType);
  112.         $key = isset(self::$fieldKeys[$fromType][$name]self::$fieldKeys[$fromType][$namenull;
  113.         if ($key === null{
  114.             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: print_r(self::$fieldKeys[$fromType]true));
  115.         }
  116.         return $toNames[$key];
  117.     }
  118.  
  119.     /**
  120.      * Returns an array of field names.
  121.      *
  122.      * @param      string $type The type of fieldnames to return:
  123.      *                       One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  124.      *                       BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  125.      * @return     array A list of field names
  126.      */
  127.  
  128.     static public function getFieldNames($type BasePeer::TYPE_PHPNAME)
  129.     {
  130.         if (!array_key_exists($typeself::$fieldNames)) {
  131.             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.');
  132.         }
  133.         return self::$fieldNames[$type];
  134.     }
  135.  
  136.     /**
  137.      * Convenience method which changes table.column to alias.column.
  138.      *
  139.      * Using this method you can maintain SQL abstraction while using column aliases.
  140.      * <code>
  141.      *        $c->addAlias("alias1", TablePeer::TABLE_NAME);
  142.      *        $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  143.      * </code>
  144.      * @param      string $alias The alias for the current table.
  145.      * @param      string $column The column name for current table. (i.e. EtvaVncTokenPeer::COLUMN_NAME).
  146.      * @return     string 
  147.      */
  148.     public static function alias($alias$column)
  149.     {
  150.         return str_replace(EtvaVncTokenPeer::TABLE_NAME.'.'$alias.'.'$column);
  151.     }
  152.  
  153.     /**
  154.      * Add all the columns needed to create a new object.
  155.      *
  156.      * Note: any columns that were marked with lazyLoad="true" in the
  157.      * XML schema will not be added to the select list and only loaded
  158.      * on demand.
  159.      *
  160.      * @param      criteria object containing the columns to add.
  161.      * @throws     PropelException Any exceptions caught during processing will be
  162.      *          rethrown wrapped into a PropelException.
  163.      */
  164.     public static function addSelectColumns(Criteria $criteria)
  165.     {
  166.  
  167.         $criteria->addSelectColumn(EtvaVncTokenPeer::USERNAME);
  168.  
  169.         $criteria->addSelectColumn(EtvaVncTokenPeer::TOKEN);
  170.  
  171.         $criteria->addSelectColumn(EtvaVncTokenPeer::ENCTOKEN);
  172.  
  173.         $criteria->addSelectColumn(EtvaVncTokenPeer::USER_ID);
  174.  
  175.         $criteria->addSelectColumn(EtvaVncTokenPeer::CREATED_AT);
  176.  
  177.     }
  178.  
  179.     /**
  180.      * Returns the number of rows matching criteria.
  181.      *
  182.      * @param      Criteria $criteria 
  183.      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  184.      * @param      PropelPDO $con 
  185.      * @return     int Number of matching rows.
  186.      */
  187.     public static function doCount(Criteria $criteria$distinct falsePropelPDO $con null)
  188.     {
  189.         // we may modify criteria, so copy it first
  190.         $criteria clone $criteria;
  191.  
  192.         // We need to set the primary table name, since in the case that there are no WHERE columns
  193.         // it will be impossible for the BasePeer::createSelectSql() method to determine which
  194.         // tables go into the FROM clause.
  195.         $criteria->setPrimaryTableName(EtvaVncTokenPeer::TABLE_NAME);
  196.  
  197.         if ($distinct && !in_array(Criteria::DISTINCT$criteria->getSelectModifiers())) {
  198.             $criteria->setDistinct();
  199.         }
  200.  
  201.         if (!$criteria->hasSelectClause()) {
  202.             EtvaVncTokenPeer::addSelectColumns($criteria);
  203.         }
  204.  
  205.         $criteria->clearOrderByColumns()// ORDER BY won't ever affect the count
  206.         $criteria->setDbName(self::DATABASE_NAME)// Set the correct dbName
  207.  
  208.         if ($con === null{
  209.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  210.         }
  211.  
  212.  
  213.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doCount:doCount'as $callable)
  214.     {
  215.       call_user_func($callable'BaseEtvaVncTokenPeer'$criteria$con);
  216.     }
  217.  
  218.  
  219.         // BasePeer returns a PDOStatement
  220.         $stmt BasePeer::doCount($criteria$con);
  221.  
  222.         if ($row $stmt->fetch(PDO::FETCH_NUM)) {
  223.             $count = (int) $row[0];
  224.         else {
  225.             $count 0// no rows returned; we infer that means 0 matches.
  226.         }
  227.         $stmt->closeCursor();
  228.         return $count;
  229.     }
  230.     /**
  231.      * Method to select one object from the DB.
  232.      *
  233.      * @param      Criteria $criteria object used to create the SELECT statement.
  234.      * @param      PropelPDO $con 
  235.      * @return     EtvaVncToken 
  236.      * @throws     PropelException Any exceptions caught during processing will be
  237.      *          rethrown wrapped into a PropelException.
  238.      */
  239.     public static function doSelectOne(Criteria $criteriaPropelPDO $con null)
  240.     {
  241.         $critcopy clone $criteria;
  242.         $critcopy->setLimit(1);
  243.         $objects EtvaVncTokenPeer::doSelect($critcopy$con);
  244.         if ($objects{
  245.             return $objects[0];
  246.         }
  247.         return null;
  248.     }
  249.     /**
  250.      * Method to do selects.
  251.      *
  252.      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  253.      * @param      PropelPDO $con 
  254.      * @return     array Array of selected Objects
  255.      * @throws     PropelException Any exceptions caught during processing will be
  256.      *          rethrown wrapped into a PropelException.
  257.      */
  258.     public static function doSelect(Criteria $criteriaPropelPDO $con null)
  259.     {
  260.         return EtvaVncTokenPeer::populateObjects(EtvaVncTokenPeer::doSelectStmt($criteria$con));
  261.     }
  262.     /**
  263.      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
  264.      *
  265.      * Use this method directly if you want to work with an executed statement durirectly (for example
  266.      * to perform your own object hydration).
  267.      *
  268.      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  269.      * @param      PropelPDO $con The connection to use
  270.      * @throws     PropelException Any exceptions caught during processing will be
  271.      *          rethrown wrapped into a PropelException.
  272.      * @return     PDOStatement The executed PDOStatement object.
  273.      * @see        BasePeer::doSelect()
  274.      */
  275.     public static function doSelectStmt(Criteria $criteriaPropelPDO $con null)
  276.     {
  277.  
  278.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doSelectStmt:doSelectStmt'as $callable)
  279.     {
  280.       call_user_func($callable'BaseEtvaVncTokenPeer'$criteria$con);
  281.     }
  282.  
  283.  
  284.         if ($con === null{
  285.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  286.         }
  287.  
  288.         if (!$criteria->hasSelectClause()) {
  289.             $criteria clone $criteria;
  290.             EtvaVncTokenPeer::addSelectColumns($criteria);
  291.         }
  292.  
  293.         // Set the correct dbName
  294.         $criteria->setDbName(self::DATABASE_NAME);
  295.  
  296.         // BasePeer returns a PDOStatement
  297.         return BasePeer::doSelect($criteria$con);
  298.     }
  299.     /**
  300.      * Adds an object to the instance pool.
  301.      *
  302.      * Propel keeps cached copies of objects in an instance pool when they are retrieved
  303.      * from the database.  In some cases -- especially when you override doSelect*()
  304.      * methods in your stub classes -- you may need to explicitly add objects
  305.      * to the cache in order to ensure that the same objects are always returned by doSelect*()
  306.      * and retrieveByPK*() calls.
  307.      *
  308.      * @param      EtvaVncToken $value A EtvaVncToken object.
  309.      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  310.      */
  311.     public static function addInstanceToPool(EtvaVncToken $obj$key null)
  312.     {
  313.         if (Propel::isInstancePoolingEnabled()) {
  314.             if ($key === null{
  315.                 $key = (string) $obj->getUsername();
  316.             // if key === null
  317.             self::$instances[$key$obj;
  318.         }
  319.     }
  320.  
  321.     /**
  322.      * Removes an object from the instance pool.
  323.      *
  324.      * Propel keeps cached copies of objects in an instance pool when they are retrieved
  325.      * from the database.  In some cases -- especially when you override doDelete
  326.      * methods in your stub classes -- you may need to explicitly remove objects
  327.      * from the cache in order to prevent returning objects that no longer exist.
  328.      *
  329.      * @param      mixed $value A EtvaVncToken object or a primary key value.
  330.      */
  331.     public static function removeInstanceFromPool($value)
  332.     {
  333.         if (Propel::isInstancePoolingEnabled(&& $value !== null{
  334.             if (is_object($value&& $value instanceof EtvaVncToken{
  335.                 $key = (string) $value->getUsername();
  336.             elseif (is_scalar($value)) {
  337.                 // assume we've been passed a primary key
  338.                 $key = (string) $value;
  339.             else {
  340.                 $e new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or EtvaVncToken object; got " (is_object($valueget_class($value' object.' var_export($value,true)));
  341.                 throw $e;
  342.             }
  343.  
  344.             unset(self::$instances[$key]);
  345.         }
  346.     // removeInstanceFromPool()
  347.  
  348.     /**
  349.      * 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.
  350.      *
  351.      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  352.      * a multi-column primary key, a serialize()d version of the primary key will be returned.
  353.      *
  354.      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  355.      * @return     EtvaVncToken Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  356.      * @see        getPrimaryKeyHash()
  357.      */
  358.     public static function getInstanceFromPool($key)
  359.     {
  360.         if (Propel::isInstancePoolingEnabled()) {
  361.             if (isset(self::$instances[$key])) {
  362.                 return self::$instances[$key];
  363.             }
  364.         }
  365.         return null// just to be explicit
  366.     }
  367.     
  368.     /**
  369.      * Clear the instance pool.
  370.      *
  371.      * @return     void 
  372.      */
  373.     public static function clearInstancePool()
  374.     {
  375.         self::$instances array();
  376.     }
  377.     
  378.     /**
  379.      * 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.
  380.      *
  381.      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  382.      * a multi-column primary key, a serialize()d version of the primary key will be returned.
  383.      *
  384.      * @param      array $row PropelPDO resultset row.
  385.      * @param      int $startcol The 0-based offset for reading from the resultset row.
  386.      * @return     string A string version of PK or NULL if the components of primary key in result array are all null.
  387.      */
  388.     public static function getPrimaryKeyHashFromRow($row$startcol 0)
  389.     {
  390.         // If the PK cannot be derived from the row, return NULL.
  391.         if ($row[$startcol 0=== null{
  392.             return null;
  393.         }
  394.         return (string) $row[$startcol 0];
  395.     }
  396.  
  397.     /**
  398.      * The returned array will contain objects of the default type or
  399.      * objects that inherit from the default.
  400.      *
  401.      * @throws     PropelException Any exceptions caught during processing will be
  402.      *          rethrown wrapped into a PropelException.
  403.      */
  404.     public static function populateObjects(PDOStatement $stmt)
  405.     {
  406.         $results array();
  407.     
  408.         // set the class once to avoid overhead in the loop
  409.         $cls EtvaVncTokenPeer::getOMClass();
  410.         $cls substr('.'.$clsstrrpos('.'.$cls'.'1);
  411.         // populate the object(s)
  412.         while ($row $stmt->fetch(PDO::FETCH_NUM)) {
  413.             $key EtvaVncTokenPeer::getPrimaryKeyHashFromRow($row0);
  414.             if (null !== ($obj EtvaVncTokenPeer::getInstanceFromPool($key))) {
  415.                 // We no longer rehydrate the object, since this can cause data loss.
  416.                 // See http://propel.phpdb.org/trac/ticket/509
  417.                 // $obj->hydrate($row, 0, true); // rehydrate
  418.                 $results[$obj;
  419.             else {
  420.         
  421.                 $obj new $cls();
  422.                 $obj->hydrate($row);
  423.                 $results[$obj;
  424.                 EtvaVncTokenPeer::addInstanceToPool($obj$key);
  425.             // if key exists
  426.         }
  427.         $stmt->closeCursor();
  428.         return $results;
  429.     }
  430.  
  431.     /**
  432.      * Returns the number of rows matching criteria, joining the related sfGuardUser table
  433.      *
  434.      * @param      Criteria $c 
  435.      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  436.      * @param      PropelPDO $con 
  437.      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  438.      * @return     int Number of matching rows.
  439.      */
  440.     public static function doCountJoinsfGuardUser(Criteria $criteria$distinct falsePropelPDO $con null$join_behavior Criteria::LEFT_JOIN)
  441.     {
  442.         // we're going to modify criteria, so copy it first
  443.         $criteria clone $criteria;
  444.  
  445.         // We need to set the primary table name, since in the case that there are no WHERE columns
  446.         // it will be impossible for the BasePeer::createSelectSql() method to determine which
  447.         // tables go into the FROM clause.
  448.         $criteria->setPrimaryTableName(EtvaVncTokenPeer::TABLE_NAME);
  449.  
  450.         if ($distinct && !in_array(Criteria::DISTINCT$criteria->getSelectModifiers())) {
  451.             $criteria->setDistinct();
  452.         }
  453.  
  454.         if (!$criteria->hasSelectClause()) {
  455.             EtvaVncTokenPeer::addSelectColumns($criteria);
  456.         }
  457.  
  458.         $criteria->clearOrderByColumns()// ORDER BY won't ever affect the count
  459.  
  460.         // Set the correct dbName
  461.         $criteria->setDbName(self::DATABASE_NAME);
  462.  
  463.         if ($con === null{
  464.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  465.         }
  466.  
  467.         $criteria->addJoin(array(EtvaVncTokenPeer::USER_ID,)array(sfGuardUserPeer::ID,)$join_behavior);
  468.  
  469.  
  470.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doCount:doCount'as $callable)
  471.     {
  472.       call_user_func($callable'BaseEtvaVncTokenPeer'$criteria$con);
  473.     }
  474.  
  475.  
  476.         $stmt BasePeer::doCount($criteria$con);
  477.  
  478.         if ($row $stmt->fetch(PDO::FETCH_NUM)) {
  479.             $count = (int) $row[0];
  480.         else {
  481.             $count 0// no rows returned; we infer that means 0 matches.
  482.         }
  483.         $stmt->closeCursor();
  484.         return $count;
  485.     }
  486.  
  487.  
  488.     /**
  489.      * Selects a collection of EtvaVncToken objects pre-filled with their sfGuardUser objects.
  490.      * @param      Criteria  $c 
  491.      * @param      PropelPDO $con 
  492.      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  493.      * @return     array Array of EtvaVncToken objects.
  494.      * @throws     PropelException Any exceptions caught during processing will be
  495.      *          rethrown wrapped into a PropelException.
  496.      */
  497.     public static function doSelectJoinsfGuardUser(Criteria $c$con null$join_behavior Criteria::LEFT_JOIN)
  498.     {
  499.  
  500.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doSelectJoin:doSelectJoin'as $callable)
  501.     {
  502.       call_user_func($callable'BaseEtvaVncTokenPeer'$c$con);
  503.     }
  504.  
  505.  
  506.         $c clone $c;
  507.  
  508.         // Set the correct dbName if it has not been overridden
  509.         if ($c->getDbName(== Propel::getDefaultDB()) {
  510.             $c->setDbName(self::DATABASE_NAME);
  511.         }
  512.  
  513.         EtvaVncTokenPeer::addSelectColumns($c);
  514.         $startcol (EtvaVncTokenPeer::NUM_COLUMNS EtvaVncTokenPeer::NUM_LAZY_LOAD_COLUMNS);
  515.         sfGuardUserPeer::addSelectColumns($c);
  516.  
  517.         $c->addJoin(array(EtvaVncTokenPeer::USER_ID,)array(sfGuardUserPeer::ID,)$join_behavior);
  518.         $stmt BasePeer::doSelect($c$con);
  519.         $results array();
  520.  
  521.         while ($row $stmt->fetch(PDO::FETCH_NUM)) {
  522.             $key1 EtvaVncTokenPeer::getPrimaryKeyHashFromRow($row0);
  523.             if (null !== ($obj1 EtvaVncTokenPeer::getInstanceFromPool($key1))) {
  524.                 // We no longer rehydrate the object, since this can cause data loss.
  525.                 // See http://propel.phpdb.org/trac/ticket/509
  526.                 // $obj1->hydrate($row, 0, true); // rehydrate
  527.             else {
  528.  
  529.                 $omClass EtvaVncTokenPeer::getOMClass();
  530.  
  531.                 $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  532.                 $obj1 new $cls();
  533.                 $obj1->hydrate($row);
  534.                 EtvaVncTokenPeer::addInstanceToPool($obj1$key1);
  535.             // if $obj1 already loaded
  536.  
  537.             $key2 sfGuardUserPeer::getPrimaryKeyHashFromRow($row$startcol);
  538.             if ($key2 !== null{
  539.                 $obj2 sfGuardUserPeer::getInstanceFromPool($key2);
  540.                 if (!$obj2{
  541.  
  542.                     $omClass sfGuardUserPeer::getOMClass();
  543.  
  544.                     $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  545.                     $obj2 new $cls();
  546.                     $obj2->hydrate($row$startcol);
  547.                     sfGuardUserPeer::addInstanceToPool($obj2$key2);
  548.                 // if obj2 already loaded
  549.  
  550.                 // Add the $obj1 (EtvaVncToken) to $obj2 (sfGuardUser)
  551.                 $obj2->addEtvaVncToken($obj1);
  552.  
  553.             // if joined row was not null
  554.  
  555.             $results[$obj1;
  556.         }
  557.         $stmt->closeCursor();
  558.         return $results;
  559.     }
  560.  
  561.  
  562.     /**
  563.      * Returns the number of rows matching criteria, joining all related tables
  564.      *
  565.      * @param      Criteria $c 
  566.      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  567.      * @param      PropelPDO $con 
  568.      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  569.      * @return     int Number of matching rows.
  570.      */
  571.     public static function doCountJoinAll(Criteria $criteria$distinct falsePropelPDO $con null$join_behavior Criteria::LEFT_JOIN)
  572.     {
  573.         // we're going to modify criteria, so copy it first
  574.         $criteria clone $criteria;
  575.  
  576.         // We need to set the primary table name, since in the case that there are no WHERE columns
  577.         // it will be impossible for the BasePeer::createSelectSql() method to determine which
  578.         // tables go into the FROM clause.
  579.         $criteria->setPrimaryTableName(EtvaVncTokenPeer::TABLE_NAME);
  580.  
  581.         if ($distinct && !in_array(Criteria::DISTINCT$criteria->getSelectModifiers())) {
  582.             $criteria->setDistinct();
  583.         }
  584.  
  585.         if (!$criteria->hasSelectClause()) {
  586.             EtvaVncTokenPeer::addSelectColumns($criteria);
  587.         }
  588.  
  589.         $criteria->clearOrderByColumns()// ORDER BY won't ever affect the count
  590.  
  591.         // Set the correct dbName
  592.         $criteria->setDbName(self::DATABASE_NAME);
  593.  
  594.         if ($con === null{
  595.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  596.         }
  597.  
  598.         $criteria->addJoin(array(EtvaVncTokenPeer::USER_ID,)array(sfGuardUserPeer::ID,)$join_behavior);
  599.  
  600.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doCount:doCount'as $callable)
  601.     {
  602.       call_user_func($callable'BaseEtvaVncTokenPeer'$criteria$con);
  603.     }
  604.  
  605.  
  606.         $stmt BasePeer::doCount($criteria$con);
  607.  
  608.         if ($row $stmt->fetch(PDO::FETCH_NUM)) {
  609.             $count = (int) $row[0];
  610.         else {
  611.             $count 0// no rows returned; we infer that means 0 matches.
  612.         }
  613.         $stmt->closeCursor();
  614.         return $count;
  615.     }
  616.  
  617.     /**
  618.      * Selects a collection of EtvaVncToken objects pre-filled with all related objects.
  619.      *
  620.      * @param      Criteria  $c 
  621.      * @param      PropelPDO $con 
  622.      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  623.      * @return     array Array of EtvaVncToken objects.
  624.      * @throws     PropelException Any exceptions caught during processing will be
  625.      *          rethrown wrapped into a PropelException.
  626.      */
  627.     public static function doSelectJoinAll(Criteria $c$con null$join_behavior Criteria::LEFT_JOIN)
  628.     {
  629.  
  630.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doSelectJoinAll:doSelectJoinAll'as $callable)
  631.     {
  632.       call_user_func($callable'BaseEtvaVncTokenPeer'$c$con);
  633.     }
  634.  
  635.  
  636.         $c clone $c;
  637.  
  638.         // Set the correct dbName if it has not been overridden
  639.         if ($c->getDbName(== Propel::getDefaultDB()) {
  640.             $c->setDbName(self::DATABASE_NAME);
  641.         }
  642.  
  643.         EtvaVncTokenPeer::addSelectColumns($c);
  644.         $startcol2 (EtvaVncTokenPeer::NUM_COLUMNS EtvaVncTokenPeer::NUM_LAZY_LOAD_COLUMNS);
  645.  
  646.         sfGuardUserPeer::addSelectColumns($c);
  647.         $startcol3 $startcol2 (sfGuardUserPeer::NUM_COLUMNS sfGuardUserPeer::NUM_LAZY_LOAD_COLUMNS);
  648.  
  649.         $c->addJoin(array(EtvaVncTokenPeer::USER_ID,)array(sfGuardUserPeer::ID,)$join_behavior);
  650.         $stmt BasePeer::doSelect($c$con);
  651.         $results array();
  652.  
  653.         while ($row $stmt->fetch(PDO::FETCH_NUM)) {
  654.             $key1 EtvaVncTokenPeer::getPrimaryKeyHashFromRow($row0);
  655.             if (null !== ($obj1 EtvaVncTokenPeer::getInstanceFromPool($key1))) {
  656.                 // We no longer rehydrate the object, since this can cause data loss.
  657.                 // See http://propel.phpdb.org/trac/ticket/509
  658.                 // $obj1->hydrate($row, 0, true); // rehydrate
  659.             else {
  660.                 $omClass EtvaVncTokenPeer::getOMClass();
  661.  
  662.                 $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  663.                 $obj1 new $cls();
  664.                 $obj1->hydrate($row);
  665.                 EtvaVncTokenPeer::addInstanceToPool($obj1$key1);
  666.             // if obj1 already loaded
  667.  
  668.             // Add objects for joined sfGuardUser rows
  669.  
  670.             $key2 sfGuardUserPeer::getPrimaryKeyHashFromRow($row$startcol2);
  671.             if ($key2 !== null{
  672.                 $obj2 sfGuardUserPeer::getInstanceFromPool($key2);
  673.                 if (!$obj2{
  674.  
  675.                     $omClass sfGuardUserPeer::getOMClass();
  676.  
  677.  
  678.                     $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  679.                     $obj2 new $cls();
  680.                     $obj2->hydrate($row$startcol2);
  681.                     sfGuardUserPeer::addInstanceToPool($obj2$key2);
  682.                 // if obj2 loaded
  683.  
  684.                 // Add the $obj1 (EtvaVncToken) to the collection in $obj2 (sfGuardUser)
  685.                 $obj2->addEtvaVncToken($obj1);
  686.             // if joined row not null
  687.  
  688.             $results[$obj1;
  689.         }
  690.         $stmt->closeCursor();
  691.         return $results;
  692.     }
  693.  
  694.  
  695.   static public function getUniqueColumnNames()
  696.   {
  697.     return array();
  698.   }
  699.     /**
  700.      * Returns the TableMap related to this peer.
  701.      * This method is not needed for general use but a specific application could have a need.
  702.      * @return     TableMap 
  703.      * @throws     PropelException Any exceptions caught during processing will be
  704.      *          rethrown wrapped into a PropelException.
  705.      */
  706.     public static function getTableMap()
  707.     {
  708.         return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  709.     }
  710.  
  711.     /**
  712.      * The class that the Peer will make instances of.
  713.      *
  714.      * This uses a dot-path notation which is tranalted into a path
  715.      * relative to a location on the PHP include_path.
  716.      * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  717.      *
  718.      * @return     string path.to.ClassName
  719.      */
  720.     public static function getOMClass()
  721.     {
  722.         return EtvaVncTokenPeer::CLASS_DEFAULT;
  723.     }
  724.  
  725.     /**
  726.      * Method perform an INSERT on the database, given a EtvaVncToken or Criteria object.
  727.      *
  728.      * @param      mixed $values Criteria or EtvaVncToken object containing data that is used to create the INSERT statement.
  729.      * @param      PropelPDO $con the PropelPDO connection to use
  730.      * @return     mixed The new primary key.
  731.      * @throws     PropelException Any exceptions caught during processing will be
  732.      *          rethrown wrapped into a PropelException.
  733.      */
  734.     public static function doInsert($valuesPropelPDO $con null)
  735.     {
  736.  
  737.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doInsert:pre'as $callable)
  738.     {
  739.       $ret call_user_func($callable'BaseEtvaVncTokenPeer'$values$con);
  740.       if (false !== $ret)
  741.       {
  742.         return $ret;
  743.       }
  744.     }
  745.  
  746.  
  747.         if ($con === null{
  748.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  749.         }
  750.  
  751.         if ($values instanceof Criteria{
  752.             $criteria clone $values// rename for clarity
  753.         else {
  754.             $criteria $values->buildCriteria()// build Criteria from EtvaVncToken object
  755.         }
  756.  
  757.  
  758.         // Set the correct dbName
  759.         $criteria->setDbName(self::DATABASE_NAME);
  760.  
  761.         try {
  762.             // use transaction because $criteria could contain info
  763.             // for more than one table (I guess, conceivably)
  764.             $con->beginTransaction();
  765.             $pk BasePeer::doInsert($criteria$con);
  766.             $con->commit();
  767.         catch(PropelException $e{
  768.             $con->rollBack();
  769.             throw $e;
  770.         }
  771.  
  772.         
  773.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doInsert:post'as $callable)
  774.     {
  775.       call_user_func($callable'BaseEtvaVncTokenPeer'$values$con$pk);
  776.     }
  777.  
  778.     return $pk;
  779.     }
  780.  
  781.     /**
  782.      * Method perform an UPDATE on the database, given a EtvaVncToken or Criteria object.
  783.      *
  784.      * @param      mixed $values Criteria or EtvaVncToken object containing data that is used to create the UPDATE statement.
  785.      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
  786.      * @return     int The number of affected rows (if supported by underlying database driver).
  787.      * @throws     PropelException Any exceptions caught during processing will be
  788.      *          rethrown wrapped into a PropelException.
  789.      */
  790.     public static function doUpdate($valuesPropelPDO $con null)
  791.     {
  792.  
  793.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doUpdate:pre'as $callable)
  794.     {
  795.       $ret call_user_func($callable'BaseEtvaVncTokenPeer'$values$con);
  796.       if (false !== $ret)
  797.       {
  798.         return $ret;
  799.       }
  800.     }
  801.  
  802.  
  803.         if ($con === null{
  804.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  805.         }
  806.  
  807.         $selectCriteria new Criteria(self::DATABASE_NAME);
  808.  
  809.         if ($values instanceof Criteria{
  810.             $criteria clone $values// rename for clarity
  811.  
  812.             $comparison $criteria->getComparison(EtvaVncTokenPeer::USERNAME);
  813.             $selectCriteria->add(EtvaVncTokenPeer::USERNAME$criteria->remove(EtvaVncTokenPeer::USERNAME)$comparison);
  814.  
  815.         else // $values is EtvaVncToken object
  816.             $criteria $values->buildCriteria()// gets full criteria
  817.             $selectCriteria $values->buildPkeyCriteria()// gets criteria w/ primary key(s)
  818.         }
  819.  
  820.         // set the correct dbName
  821.         $criteria->setDbName(self::DATABASE_NAME);
  822.  
  823.         $ret BasePeer::doUpdate($selectCriteria$criteria$con);
  824.     
  825.  
  826.     foreach (sfMixer::getCallables('BaseEtvaVncTokenPeer:doUpdate:post'as $callable)
  827.     {
  828.       call_user_func($callable'BaseEtvaVncTokenPeer'$values$con$ret);
  829.     }
  830.  
  831.     return $ret;
  832.   }
  833.  
  834.     /**
  835.      * Method to DELETE all rows from the vnc_token table.
  836.      *
  837.      * @return     int The number of affected rows (if supported by underlying database driver).
  838.      */
  839.     public static function doDeleteAll($con null)
  840.     {
  841.         if ($con === null{
  842.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  843.         }
  844.         $affectedRows 0// initialize var to track total num of affected rows
  845.         try {
  846.             // use transaction because $criteria could contain info
  847.             // for more than one table or we could emulating ON DELETE CASCADE, etc.
  848.             $con->beginTransaction();
  849.             $affectedRows += BasePeer::doDeleteAll(EtvaVncTokenPeer::TABLE_NAME$con);
  850.             $con->commit();
  851.             return $affectedRows;
  852.         catch (PropelException $e{
  853.             $con->rollBack();
  854.             throw $e;
  855.         }
  856.     }
  857.  
  858.     /**
  859.      * Method perform a DELETE on the database, given a EtvaVncToken or Criteria object OR a primary key value.
  860.      *
  861.      * @param      mixed $values Criteria or EtvaVncToken object or primary key or array of primary keys
  862.      *               which is used to create the DELETE statement
  863.      * @param      PropelPDO $con the connection to use
  864.      * @return     int     The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
  865.      *                 if supported by native driver or if emulated using Propel.
  866.      * @throws     PropelException Any exceptions caught during processing will be
  867.      *          rethrown wrapped into a PropelException.
  868.      */
  869.      public static function doDelete($valuesPropelPDO $con null)
  870.      {
  871.         if ($con === null{
  872.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  873.         }
  874.  
  875.         if ($values instanceof Criteria{
  876.             // invalidate the cache for all objects of this type, since we have no
  877.             // way of knowing (without running a query) what objects should be invalidated
  878.             // from the cache based on this Criteria.
  879.             EtvaVncTokenPeer::clearInstancePool();
  880.  
  881.             // rename for clarity
  882.             $criteria clone $values;
  883.         elseif ($values instanceof EtvaVncToken{
  884.             // invalidate the cache for this single object
  885.             EtvaVncTokenPeer::removeInstanceFromPool($values);
  886.             // create criteria based on pk values
  887.             $criteria $values->buildPkeyCriteria();
  888.         else {
  889.             // it must be the primary key
  890.  
  891.  
  892.  
  893.             $criteria new Criteria(self::DATABASE_NAME);
  894.             $criteria->add(EtvaVncTokenPeer::USERNAME(array) $valuesCriteria::IN);
  895.  
  896.             foreach ((array) $values as $singleval{
  897.                 // we can invalidate the cache for this single object
  898.                 EtvaVncTokenPeer::removeInstanceFromPool($singleval);
  899.             }
  900.         }
  901.  
  902.         // Set the correct dbName
  903.         $criteria->setDbName(self::DATABASE_NAME);
  904.  
  905.         $affectedRows 0// initialize var to track total num of affected rows
  906.  
  907.         try {
  908.             // use transaction because $criteria could contain info
  909.             // for more than one table or we could emulating ON DELETE CASCADE, etc.
  910.             $con->beginTransaction();
  911.             
  912.             $affectedRows += BasePeer::doDelete($criteria$con);
  913.  
  914.             $con->commit();
  915.             return $affectedRows;
  916.         catch (PropelException $e{
  917.             $con->rollBack();
  918.             throw $e;
  919.         }
  920.     }
  921.  
  922.     /**
  923.      * Validates all modified columns of given EtvaVncToken object.
  924.      * If parameter $columns is either a single column name or an array of column names
  925.      * than only those columns are validated.
  926.      *
  927.      * NOTICE: This does not apply to primary or foreign keys for now.
  928.      *
  929.      * @param      EtvaVncToken $obj The object to validate.
  930.      * @param      mixed $cols Column name or array of column names.
  931.      *
  932.      * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
  933.      */
  934.     public static function doValidate(EtvaVncToken $obj$cols null)
  935.     {
  936.         $columns array();
  937.  
  938.         if ($cols{
  939.             $dbMap Propel::getDatabaseMap(EtvaVncTokenPeer::DATABASE_NAME);
  940.             $tableMap $dbMap->getTable(EtvaVncTokenPeer::TABLE_NAME);
  941.  
  942.             if (is_array($cols)) {
  943.                 $cols array($cols);
  944.             }
  945.  
  946.             foreach ($cols as $colName{
  947.                 if ($tableMap->containsColumn($colName)) {
  948.                     $get 'get' $tableMap->getColumn($colName)->getPhpName();
  949.                     $columns[$colName$obj->$get();
  950.                 }
  951.             }
  952.         else {
  953.  
  954.         }
  955.  
  956.         $res =  BasePeer::doValidate(EtvaVncTokenPeer::DATABASE_NAMEEtvaVncTokenPeer::TABLE_NAME$columns);
  957.     if ($res !== true{
  958.         $request sfContext::getInstance()->getRequest();
  959.         foreach ($res as $failed{
  960.             $col EtvaVncTokenPeer::translateFieldname($failed->getColumn()BasePeer::TYPE_COLNAMEBasePeer::TYPE_PHPNAME);
  961.         }
  962.     }
  963.  
  964.     return $res;
  965.     }
  966.  
  967.     /**
  968.      * Retrieve a single object by pkey.
  969.      *
  970.      * @param      string $pk the primary key.
  971.      * @param      PropelPDO $con the connection to use
  972.      * @return     EtvaVncToken 
  973.      */
  974.     public static function retrieveByPK($pkPropelPDO $con null)
  975.     {
  976.  
  977.         if (null !== ($obj EtvaVncTokenPeer::getInstanceFromPool((string) $pk))) {
  978.             return $obj;
  979.         }
  980.  
  981.         if ($con === null{
  982.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  983.         }
  984.  
  985.         $criteria new Criteria(EtvaVncTokenPeer::DATABASE_NAME);
  986.         $criteria->add(EtvaVncTokenPeer::USERNAME$pk);
  987.  
  988.         $v EtvaVncTokenPeer::doSelect($criteria$con);
  989.  
  990.         return !empty($v$v[0null;
  991.     }
  992.  
  993.     /**
  994.      * Retrieve multiple objects by pkey.
  995.      *
  996.      * @param      array $pks List of primary keys
  997.      * @param      PropelPDO $con the connection to use
  998.      * @throws     PropelException Any exceptions caught during processing will be
  999.      *          rethrown wrapped into a PropelException.
  1000.      */
  1001.     public static function retrieveByPKs($pksPropelPDO $con null)
  1002.     {
  1003.         if ($con === null{
  1004.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  1005.         }
  1006.  
  1007.         $objs null;
  1008.         if (empty($pks)) {
  1009.             $objs array();
  1010.         else {
  1011.             $criteria new Criteria(EtvaVncTokenPeer::DATABASE_NAME);
  1012.             $criteria->add(EtvaVncTokenPeer::USERNAME$pksCriteria::IN);
  1013.             $objs EtvaVncTokenPeer::doSelect($criteria$con);
  1014.         }
  1015.         return $objs;
  1016.     }
  1017.  
  1018. // BaseEtvaVncTokenPeer
  1019.  
  1020. // This is the static code needed to register the MapBuilder for this table with the main Propel class.
  1021. //
  1022. // NOTE: This static code cannot call methods on the EtvaVncTokenPeer class, because it is not defined yet.
  1023. // If you need to use overridden methods, you can add this code to the bottom of the EtvaVncTokenPeer class:
  1024. //
  1025. // Propel::getDatabaseMap(EtvaVncTokenPeer::DATABASE_NAME)->addTableBuilder(EtvaVncTokenPeer::TABLE_NAME, EtvaVncTokenPeer::getMapBuilder());
  1026. //
  1027. // Doing so will effectively overwrite the registration below.
  1028.  
  1029. Propel::getDatabaseMap(BaseEtvaVncTokenPeer::DATABASE_NAME)->addTableBuilder(BaseEtvaVncTokenPeer::TABLE_NAMEBaseEtvaVncTokenPeer::getMapBuilder());

Documentation generated on Fri, 19 Jun 2009 10:48:26 +0100 by phpDocumentor 1.4.2