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

Source for file BaseEtvaVlanPeer.php

Documentation is available at BaseEtvaVlanPeer.php

  1. <?php
  2.  
  3. /**
  4.  * Base static class for performing query and update operations on the 'vlan' table.
  5.  *
  6.  * 
  7.  *
  8.  * This class was autogenerated by Propel 1.3.0-dev on:
  9.  *
  10.  * Thu Jun 18 14:28:37 2009
  11.  *
  12.  * @package    lib.model.om
  13.  */
  14. abstract class BaseEtvaVlanPeer {
  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 'vlan';
  21.  
  22.     /** A class that can be returned by this peer. */
  23.     const CLASS_DEFAULT 'lib.model.EtvaVlan';
  24.  
  25.     /** The total number of columns. */
  26.     const NUM_COLUMNS 2;
  27.  
  28.     /** The number of lazy-loaded columns. */
  29.     const NUM_LAZY_LOAD_COLUMNS 0;
  30.  
  31.     /** the column name for the ID field */
  32.     const ID 'vlan.ID';
  33.  
  34.     /** the column name for the NAME field */
  35.     const NAME 'vlan.NAME';
  36.  
  37.     /**
  38.      * An identiy map to hold any loaded instances of EtvaVlan objects.
  39.      * This must be public so that other peer classes can access this when hydrating from JOIN
  40.      * queries.
  41.      * @var        array EtvaVlan[]
  42.      */
  43.     public static $instances array();
  44.  
  45.     /**
  46.      * The MapBuilder instance for this peer.
  47.      * @var        MapBuilder 
  48.      */
  49.     private static $mapBuilder null;
  50.  
  51.     /**
  52.      * holds an array of fieldnames
  53.      *
  54.      * first dimension keys are the type constants
  55.      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  56.      */
  57.     private static $fieldNames array (
  58.         BasePeer::TYPE_PHPNAME => array ('Id''Name'),
  59.         BasePeer::TYPE_STUDLYPHPNAME => array ('id''name'),
  60.         BasePeer::TYPE_COLNAME => array (self::IDself::NAME),
  61.         BasePeer::TYPE_FIELDNAME => array ('id''name'),
  62.         BasePeer::TYPE_NUM => array (01)
  63.     );
  64.  
  65.     /**
  66.      * holds an array of keys for quick access to the fieldnames array
  67.      *
  68.      * first dimension keys are the type constants
  69.      * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  70.      */
  71.     private static $fieldKeys array (
  72.         BasePeer::TYPE_PHPNAME => array ('Id' => 0'Name' => 1),
  73.         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0'name' => 1),
  74.         BasePeer::TYPE_COLNAME => array (self::ID => 0self::NAME => 1),
  75.         BasePeer::TYPE_FIELDNAME => array ('id' => 0'name' => 1),
  76.         BasePeer::TYPE_NUM => array (01)
  77.     );
  78.  
  79.     /**
  80.      * Get a (singleton) instance of the MapBuilder for this peer class.
  81.      * @return     MapBuilder The map builder for this peer
  82.      */
  83.     public static function getMapBuilder()
  84.     {
  85.         if (self::$mapBuilder === null{
  86.             self::$mapBuilder new EtvaVlanMapBuilder();
  87.         }
  88.         return self::$mapBuilder;
  89.     }
  90.     /**
  91.      * Translates a fieldname to another type
  92.      *
  93.      * @param      string $name field name
  94.      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  95.      *                          BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  96.      * @param      string $toType   One of the class type constants
  97.      * @return     string translated name of the field.
  98.      * @throws     PropelException - if the specified name could not be found in the fieldname mappings.
  99.      */
  100.     static public function translateFieldName($name$fromType$toType)
  101.     {
  102.         $toNames self::getFieldNames($toType);
  103.         $key = isset(self::$fieldKeys[$fromType][$name]self::$fieldKeys[$fromType][$namenull;
  104.         if ($key === null{
  105.             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: print_r(self::$fieldKeys[$fromType]true));
  106.         }
  107.         return $toNames[$key];
  108.     }
  109.  
  110.     /**
  111.      * Returns an array of field names.
  112.      *
  113.      * @param      string $type The type of fieldnames to return:
  114.      *                       One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  115.      *                       BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  116.      * @return     array A list of field names
  117.      */
  118.  
  119.     static public function getFieldNames($type BasePeer::TYPE_PHPNAME)
  120.     {
  121.         if (!array_key_exists($typeself::$fieldNames)) {
  122.             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.');
  123.         }
  124.         return self::$fieldNames[$type];
  125.     }
  126.  
  127.     /**
  128.      * Convenience method which changes table.column to alias.column.
  129.      *
  130.      * Using this method you can maintain SQL abstraction while using column aliases.
  131.      * <code>
  132.      *        $c->addAlias("alias1", TablePeer::TABLE_NAME);
  133.      *        $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  134.      * </code>
  135.      * @param      string $alias The alias for the current table.
  136.      * @param      string $column The column name for current table. (i.e. EtvaVlanPeer::COLUMN_NAME).
  137.      * @return     string 
  138.      */
  139.     public static function alias($alias$column)
  140.     {
  141.         return str_replace(EtvaVlanPeer::TABLE_NAME.'.'$alias.'.'$column);
  142.     }
  143.  
  144.     /**
  145.      * Add all the columns needed to create a new object.
  146.      *
  147.      * Note: any columns that were marked with lazyLoad="true" in the
  148.      * XML schema will not be added to the select list and only loaded
  149.      * on demand.
  150.      *
  151.      * @param      criteria object containing the columns to add.
  152.      * @throws     PropelException Any exceptions caught during processing will be
  153.      *          rethrown wrapped into a PropelException.
  154.      */
  155.     public static function addSelectColumns(Criteria $criteria)
  156.     {
  157.  
  158.         $criteria->addSelectColumn(EtvaVlanPeer::ID);
  159.  
  160.         $criteria->addSelectColumn(EtvaVlanPeer::NAME);
  161.  
  162.     }
  163.  
  164.     /**
  165.      * Returns the number of rows matching criteria.
  166.      *
  167.      * @param      Criteria $criteria 
  168.      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  169.      * @param      PropelPDO $con 
  170.      * @return     int Number of matching rows.
  171.      */
  172.     public static function doCount(Criteria $criteria$distinct falsePropelPDO $con null)
  173.     {
  174.         // we may modify criteria, so copy it first
  175.         $criteria clone $criteria;
  176.  
  177.         // We need to set the primary table name, since in the case that there are no WHERE columns
  178.         // it will be impossible for the BasePeer::createSelectSql() method to determine which
  179.         // tables go into the FROM clause.
  180.         $criteria->setPrimaryTableName(EtvaVlanPeer::TABLE_NAME);
  181.  
  182.         if ($distinct && !in_array(Criteria::DISTINCT$criteria->getSelectModifiers())) {
  183.             $criteria->setDistinct();
  184.         }
  185.  
  186.         if (!$criteria->hasSelectClause()) {
  187.             EtvaVlanPeer::addSelectColumns($criteria);
  188.         }
  189.  
  190.         $criteria->clearOrderByColumns()// ORDER BY won't ever affect the count
  191.         $criteria->setDbName(self::DATABASE_NAME)// Set the correct dbName
  192.  
  193.         if ($con === null{
  194.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  195.         }
  196.  
  197.  
  198.     foreach (sfMixer::getCallables('BaseEtvaVlanPeer:doCount:doCount'as $callable)
  199.     {
  200.       call_user_func($callable'BaseEtvaVlanPeer'$criteria$con);
  201.     }
  202.  
  203.  
  204.         // BasePeer returns a PDOStatement
  205.         $stmt BasePeer::doCount($criteria$con);
  206.  
  207.         if ($row $stmt->fetch(PDO::FETCH_NUM)) {
  208.             $count = (int) $row[0];
  209.         else {
  210.             $count 0// no rows returned; we infer that means 0 matches.
  211.         }
  212.         $stmt->closeCursor();
  213.         return $count;
  214.     }
  215.     /**
  216.      * Method to select one object from the DB.
  217.      *
  218.      * @param      Criteria $criteria object used to create the SELECT statement.
  219.      * @param      PropelPDO $con 
  220.      * @return     EtvaVlan 
  221.      * @throws     PropelException Any exceptions caught during processing will be
  222.      *          rethrown wrapped into a PropelException.
  223.      */
  224.     public static function doSelectOne(Criteria $criteriaPropelPDO $con null)
  225.     {
  226.         $critcopy clone $criteria;
  227.         $critcopy->setLimit(1);
  228.         $objects EtvaVlanPeer::doSelect($critcopy$con);
  229.         if ($objects{
  230.             return $objects[0];
  231.         }
  232.         return null;
  233.     }
  234.     /**
  235.      * Method to do selects.
  236.      *
  237.      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  238.      * @param      PropelPDO $con 
  239.      * @return     array Array of selected Objects
  240.      * @throws     PropelException Any exceptions caught during processing will be
  241.      *          rethrown wrapped into a PropelException.
  242.      */
  243.     public static function doSelect(Criteria $criteriaPropelPDO $con null)
  244.     {
  245.         return EtvaVlanPeer::populateObjects(EtvaVlanPeer::doSelectStmt($criteria$con));
  246.     }
  247.     /**
  248.      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
  249.      *
  250.      * Use this method directly if you want to work with an executed statement durirectly (for example
  251.      * to perform your own object hydration).
  252.      *
  253.      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  254.      * @param      PropelPDO $con The connection to use
  255.      * @throws     PropelException Any exceptions caught during processing will be
  256.      *          rethrown wrapped into a PropelException.
  257.      * @return     PDOStatement The executed PDOStatement object.
  258.      * @see        BasePeer::doSelect()
  259.      */
  260.     public static function doSelectStmt(Criteria $criteriaPropelPDO $con null)
  261.     {
  262.  
  263.     foreach (sfMixer::getCallables('BaseEtvaVlanPeer:doSelectStmt:doSelectStmt'as $callable)
  264.     {
  265.       call_user_func($callable'BaseEtvaVlanPeer'$criteria$con);
  266.     }
  267.  
  268.  
  269.         if ($con === null{
  270.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  271.         }
  272.  
  273.         if (!$criteria->hasSelectClause()) {
  274.             $criteria clone $criteria;
  275.             EtvaVlanPeer::addSelectColumns($criteria);
  276.         }
  277.  
  278.         // Set the correct dbName
  279.         $criteria->setDbName(self::DATABASE_NAME);
  280.  
  281.         // BasePeer returns a PDOStatement
  282.         return BasePeer::doSelect($criteria$con);
  283.     }
  284.     /**
  285.      * Adds an object to the instance pool.
  286.      *
  287.      * Propel keeps cached copies of objects in an instance pool when they are retrieved
  288.      * from the database.  In some cases -- especially when you override doSelect*()
  289.      * methods in your stub classes -- you may need to explicitly add objects
  290.      * to the cache in order to ensure that the same objects are always returned by doSelect*()
  291.      * and retrieveByPK*() calls.
  292.      *
  293.      * @param      EtvaVlan $value A EtvaVlan object.
  294.      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  295.      */
  296.     public static function addInstanceToPool(EtvaVlan $obj$key null)
  297.     {
  298.         if (Propel::isInstancePoolingEnabled()) {
  299.             if ($key === null{
  300.                 $key = (string) $obj->getId();
  301.             // if key === null
  302.             self::$instances[$key$obj;
  303.         }
  304.     }
  305.  
  306.     /**
  307.      * Removes an object from the instance pool.
  308.      *
  309.      * Propel keeps cached copies of objects in an instance pool when they are retrieved
  310.      * from the database.  In some cases -- especially when you override doDelete
  311.      * methods in your stub classes -- you may need to explicitly remove objects
  312.      * from the cache in order to prevent returning objects that no longer exist.
  313.      *
  314.      * @param      mixed $value A EtvaVlan object or a primary key value.
  315.      */
  316.     public static function removeInstanceFromPool($value)
  317.     {
  318.         if (Propel::isInstancePoolingEnabled(&& $value !== null{
  319.             if (is_object($value&& $value instanceof EtvaVlan{
  320.                 $key = (string) $value->getId();
  321.             elseif (is_scalar($value)) {
  322.                 // assume we've been passed a primary key
  323.                 $key = (string) $value;
  324.             else {
  325.                 $e new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or EtvaVlan object; got " (is_object($valueget_class($value' object.' var_export($value,true)));
  326.                 throw $e;
  327.             }
  328.  
  329.             unset(self::$instances[$key]);
  330.         }
  331.     // removeInstanceFromPool()
  332.  
  333.     /**
  334.      * 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.
  335.      *
  336.      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  337.      * a multi-column primary key, a serialize()d version of the primary key will be returned.
  338.      *
  339.      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
  340.      * @return     EtvaVlan Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  341.      * @see        getPrimaryKeyHash()
  342.      */
  343.     public static function getInstanceFromPool($key)
  344.     {
  345.         if (Propel::isInstancePoolingEnabled()) {
  346.             if (isset(self::$instances[$key])) {
  347.                 return self::$instances[$key];
  348.             }
  349.         }
  350.         return null// just to be explicit
  351.     }
  352.     
  353.     /**
  354.      * Clear the instance pool.
  355.      *
  356.      * @return     void 
  357.      */
  358.     public static function clearInstancePool()
  359.     {
  360.         self::$instances array();
  361.     }
  362.     
  363.     /**
  364.      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  365.      *
  366.      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
  367.      * a multi-column primary key, a serialize()d version of the primary key will be returned.
  368.      *
  369.      * @param      array $row PropelPDO resultset row.
  370.      * @param      int $startcol The 0-based offset for reading from the resultset row.
  371.      * @return     string A string version of PK or NULL if the components of primary key in result array are all null.
  372.      */
  373.     public static function getPrimaryKeyHashFromRow($row$startcol 0)
  374.     {
  375.         // If the PK cannot be derived from the row, return NULL.
  376.         if ($row[$startcol 0=== null{
  377.             return null;
  378.         }
  379.         return (string) $row[$startcol 0];
  380.     }
  381.  
  382.     /**
  383.      * The returned array will contain objects of the default type or
  384.      * objects that inherit from the default.
  385.      *
  386.      * @throws     PropelException Any exceptions caught during processing will be
  387.      *          rethrown wrapped into a PropelException.
  388.      */
  389.     public static function populateObjects(PDOStatement $stmt)
  390.     {
  391.         $results array();
  392.     
  393.         // set the class once to avoid overhead in the loop
  394.         $cls EtvaVlanPeer::getOMClass();
  395.         $cls substr('.'.$clsstrrpos('.'.$cls'.'1);
  396.         // populate the object(s)
  397.         while ($row $stmt->fetch(PDO::FETCH_NUM)) {
  398.             $key EtvaVlanPeer::getPrimaryKeyHashFromRow($row0);
  399.             if (null !== ($obj EtvaVlanPeer::getInstanceFromPool($key))) {
  400.                 // We no longer rehydrate the object, since this can cause data loss.
  401.                 // See http://propel.phpdb.org/trac/ticket/509
  402.                 // $obj->hydrate($row, 0, true); // rehydrate
  403.                 $results[$obj;
  404.             else {
  405.         
  406.                 $obj new $cls();
  407.                 $obj->hydrate($row);
  408.                 $results[$obj;
  409.                 EtvaVlanPeer::addInstanceToPool($obj$key);
  410.             // if key exists
  411.         }
  412.         $stmt->closeCursor();
  413.         return $results;
  414.     }
  415.  
  416.   static public function getUniqueColumnNames()
  417.   {
  418.     return array();
  419.   }
  420.     /**
  421.      * Returns the TableMap related to this peer.
  422.      * This method is not needed for general use but a specific application could have a need.
  423.      * @return     TableMap 
  424.      * @throws     PropelException Any exceptions caught during processing will be
  425.      *          rethrown wrapped into a PropelException.
  426.      */
  427.     public static function getTableMap()
  428.     {
  429.         return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  430.     }
  431.  
  432.     /**
  433.      * The class that the Peer will make instances of.
  434.      *
  435.      * This uses a dot-path notation which is tranalted into a path
  436.      * relative to a location on the PHP include_path.
  437.      * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  438.      *
  439.      * @return     string path.to.ClassName
  440.      */
  441.     public static function getOMClass()
  442.     {
  443.         return EtvaVlanPeer::CLASS_DEFAULT;
  444.     }
  445.  
  446.     /**
  447.      * Method perform an INSERT on the database, given a EtvaVlan or Criteria object.
  448.      *
  449.      * @param      mixed $values Criteria or EtvaVlan object containing data that is used to create the INSERT statement.
  450.      * @param      PropelPDO $con the PropelPDO connection to use
  451.      * @return     mixed The new primary key.
  452.      * @throws     PropelException Any exceptions caught during processing will be
  453.      *          rethrown wrapped into a PropelException.
  454.      */
  455.     public static function doInsert($valuesPropelPDO $con null)
  456.     {
  457.  
  458.     foreach (sfMixer::getCallables('BaseEtvaVlanPeer:doInsert:pre'as $callable)
  459.     {
  460.       $ret call_user_func($callable'BaseEtvaVlanPeer'$values$con);
  461.       if (false !== $ret)
  462.       {
  463.         return $ret;
  464.       }
  465.     }
  466.  
  467.  
  468.         if ($con === null{
  469.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  470.         }
  471.  
  472.         if ($values instanceof Criteria{
  473.             $criteria clone $values// rename for clarity
  474.         else {
  475.             $criteria $values->buildCriteria()// build Criteria from EtvaVlan object
  476.         }
  477.  
  478.         if ($criteria->containsKey(EtvaVlanPeer::ID&& $criteria->keyContainsValue(EtvaVlanPeer::ID) ) {
  479.             throw new PropelException('Cannot insert a value for auto-increment primary key ('.EtvaVlanPeer::ID.')');
  480.         }
  481.  
  482.  
  483.         // Set the correct dbName
  484.         $criteria->setDbName(self::DATABASE_NAME);
  485.  
  486.         try {
  487.             // use transaction because $criteria could contain info
  488.             // for more than one table (I guess, conceivably)
  489.             $con->beginTransaction();
  490.             $pk BasePeer::doInsert($criteria$con);
  491.             $con->commit();
  492.         catch(PropelException $e{
  493.             $con->rollBack();
  494.             throw $e;
  495.         }
  496.  
  497.         
  498.     foreach (sfMixer::getCallables('BaseEtvaVlanPeer:doInsert:post'as $callable)
  499.     {
  500.       call_user_func($callable'BaseEtvaVlanPeer'$values$con$pk);
  501.     }
  502.  
  503.     return $pk;
  504.     }
  505.  
  506.     /**
  507.      * Method perform an UPDATE on the database, given a EtvaVlan or Criteria object.
  508.      *
  509.      * @param      mixed $values Criteria or EtvaVlan object containing data that is used to create the UPDATE statement.
  510.      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
  511.      * @return     int The number of affected rows (if supported by underlying database driver).
  512.      * @throws     PropelException Any exceptions caught during processing will be
  513.      *          rethrown wrapped into a PropelException.
  514.      */
  515.     public static function doUpdate($valuesPropelPDO $con null)
  516.     {
  517.  
  518.     foreach (sfMixer::getCallables('BaseEtvaVlanPeer:doUpdate:pre'as $callable)
  519.     {
  520.       $ret call_user_func($callable'BaseEtvaVlanPeer'$values$con);
  521.       if (false !== $ret)
  522.       {
  523.         return $ret;
  524.       }
  525.     }
  526.  
  527.  
  528.         if ($con === null{
  529.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  530.         }
  531.  
  532.         $selectCriteria new Criteria(self::DATABASE_NAME);
  533.  
  534.         if ($values instanceof Criteria{
  535.             $criteria clone $values// rename for clarity
  536.  
  537.             $comparison $criteria->getComparison(EtvaVlanPeer::ID);
  538.             $selectCriteria->add(EtvaVlanPeer::ID$criteria->remove(EtvaVlanPeer::ID)$comparison);
  539.  
  540.         else // $values is EtvaVlan object
  541.             $criteria $values->buildCriteria()// gets full criteria
  542.             $selectCriteria $values->buildPkeyCriteria()// gets criteria w/ primary key(s)
  543.         }
  544.  
  545.         // set the correct dbName
  546.         $criteria->setDbName(self::DATABASE_NAME);
  547.  
  548.         $ret BasePeer::doUpdate($selectCriteria$criteria$con);
  549.     
  550.  
  551.     foreach (sfMixer::getCallables('BaseEtvaVlanPeer:doUpdate:post'as $callable)
  552.     {
  553.       call_user_func($callable'BaseEtvaVlanPeer'$values$con$ret);
  554.     }
  555.  
  556.     return $ret;
  557.   }
  558.  
  559.     /**
  560.      * Method to DELETE all rows from the vlan table.
  561.      *
  562.      * @return     int The number of affected rows (if supported by underlying database driver).
  563.      */
  564.     public static function doDeleteAll($con null)
  565.     {
  566.         if ($con === null{
  567.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  568.         }
  569.         $affectedRows 0// initialize var to track total num of affected rows
  570.         try {
  571.             // use transaction because $criteria could contain info
  572.             // for more than one table or we could emulating ON DELETE CASCADE, etc.
  573.             $con->beginTransaction();
  574.             $affectedRows += BasePeer::doDeleteAll(EtvaVlanPeer::TABLE_NAME$con);
  575.             $con->commit();
  576.             return $affectedRows;
  577.         catch (PropelException $e{
  578.             $con->rollBack();
  579.             throw $e;
  580.         }
  581.     }
  582.  
  583.     /**
  584.      * Method perform a DELETE on the database, given a EtvaVlan or Criteria object OR a primary key value.
  585.      *
  586.      * @param      mixed $values Criteria or EtvaVlan object or primary key or array of primary keys
  587.      *               which is used to create the DELETE statement
  588.      * @param      PropelPDO $con the connection to use
  589.      * @return     int     The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
  590.      *                 if supported by native driver or if emulated using Propel.
  591.      * @throws     PropelException Any exceptions caught during processing will be
  592.      *          rethrown wrapped into a PropelException.
  593.      */
  594.      public static function doDelete($valuesPropelPDO $con null)
  595.      {
  596.         if ($con === null{
  597.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  598.         }
  599.  
  600.         if ($values instanceof Criteria{
  601.             // invalidate the cache for all objects of this type, since we have no
  602.             // way of knowing (without running a query) what objects should be invalidated
  603.             // from the cache based on this Criteria.
  604.             EtvaVlanPeer::clearInstancePool();
  605.  
  606.             // rename for clarity
  607.             $criteria clone $values;
  608.         elseif ($values instanceof EtvaVlan{
  609.             // invalidate the cache for this single object
  610.             EtvaVlanPeer::removeInstanceFromPool($values);
  611.             // create criteria based on pk values
  612.             $criteria $values->buildPkeyCriteria();
  613.         else {
  614.             // it must be the primary key
  615.  
  616.  
  617.  
  618.             $criteria new Criteria(self::DATABASE_NAME);
  619.             $criteria->add(EtvaVlanPeer::ID(array) $valuesCriteria::IN);
  620.  
  621.             foreach ((array) $values as $singleval{
  622.                 // we can invalidate the cache for this single object
  623.                 EtvaVlanPeer::removeInstanceFromPool($singleval);
  624.             }
  625.         }
  626.  
  627.         // Set the correct dbName
  628.         $criteria->setDbName(self::DATABASE_NAME);
  629.  
  630.         $affectedRows 0// initialize var to track total num of affected rows
  631.  
  632.         try {
  633.             // use transaction because $criteria could contain info
  634.             // for more than one table or we could emulating ON DELETE CASCADE, etc.
  635.             $con->beginTransaction();
  636.             
  637.             $affectedRows += BasePeer::doDelete($criteria$con);
  638.  
  639.             $con->commit();
  640.             return $affectedRows;
  641.         catch (PropelException $e{
  642.             $con->rollBack();
  643.             throw $e;
  644.         }
  645.     }
  646.  
  647.     /**
  648.      * Validates all modified columns of given EtvaVlan object.
  649.      * If parameter $columns is either a single column name or an array of column names
  650.      * than only those columns are validated.
  651.      *
  652.      * NOTICE: This does not apply to primary or foreign keys for now.
  653.      *
  654.      * @param      EtvaVlan $obj The object to validate.
  655.      * @param      mixed $cols Column name or array of column names.
  656.      *
  657.      * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
  658.      */
  659.     public static function doValidate(EtvaVlan $obj$cols null)
  660.     {
  661.         $columns array();
  662.  
  663.         if ($cols{
  664.             $dbMap Propel::getDatabaseMap(EtvaVlanPeer::DATABASE_NAME);
  665.             $tableMap $dbMap->getTable(EtvaVlanPeer::TABLE_NAME);
  666.  
  667.             if (is_array($cols)) {
  668.                 $cols array($cols);
  669.             }
  670.  
  671.             foreach ($cols as $colName{
  672.                 if ($tableMap->containsColumn($colName)) {
  673.                     $get 'get' $tableMap->getColumn($colName)->getPhpName();
  674.                     $columns[$colName$obj->$get();
  675.                 }
  676.             }
  677.         else {
  678.  
  679.         }
  680.  
  681.         $res =  BasePeer::doValidate(EtvaVlanPeer::DATABASE_NAMEEtvaVlanPeer::TABLE_NAME$columns);
  682.     if ($res !== true{
  683.         $request sfContext::getInstance()->getRequest();
  684.         foreach ($res as $failed{
  685.             $col EtvaVlanPeer::translateFieldname($failed->getColumn()BasePeer::TYPE_COLNAMEBasePeer::TYPE_PHPNAME);
  686.         }
  687.     }
  688.  
  689.     return $res;
  690.     }
  691.  
  692.     /**
  693.      * Retrieve a single object by pkey.
  694.      *
  695.      * @param      int $pk the primary key.
  696.      * @param      PropelPDO $con the connection to use
  697.      * @return     EtvaVlan 
  698.      */
  699.     public static function retrieveByPK($pkPropelPDO $con null)
  700.     {
  701.  
  702.         if (null !== ($obj EtvaVlanPeer::getInstanceFromPool((string) $pk))) {
  703.             return $obj;
  704.         }
  705.  
  706.         if ($con === null{
  707.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  708.         }
  709.  
  710.         $criteria new Criteria(EtvaVlanPeer::DATABASE_NAME);
  711.         $criteria->add(EtvaVlanPeer::ID$pk);
  712.  
  713.         $v EtvaVlanPeer::doSelect($criteria$con);
  714.  
  715.         return !empty($v$v[0null;
  716.     }
  717.  
  718.     /**
  719.      * Retrieve multiple objects by pkey.
  720.      *
  721.      * @param      array $pks List of primary keys
  722.      * @param      PropelPDO $con the connection to use
  723.      * @throws     PropelException Any exceptions caught during processing will be
  724.      *          rethrown wrapped into a PropelException.
  725.      */
  726.     public static function retrieveByPKs($pksPropelPDO $con null)
  727.     {
  728.         if ($con === null{
  729.             $con Propel::getConnection(EtvaVlanPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  730.         }
  731.  
  732.         $objs null;
  733.         if (empty($pks)) {
  734.             $objs array();
  735.         else {
  736.             $criteria new Criteria(EtvaVlanPeer::DATABASE_NAME);
  737.             $criteria->add(EtvaVlanPeer::ID$pksCriteria::IN);
  738.             $objs EtvaVlanPeer::doSelect($criteria$con);
  739.         }
  740.         return $objs;
  741.     }
  742.  
  743. // BaseEtvaVlanPeer
  744.  
  745. // This is the static code needed to register the MapBuilder for this table with the main Propel class.
  746. //
  747. // NOTE: This static code cannot call methods on the EtvaVlanPeer class, because it is not defined yet.
  748. // If you need to use overridden methods, you can add this code to the bottom of the EtvaVlanPeer class:
  749. //
  750. // Propel::getDatabaseMap(EtvaVlanPeer::DATABASE_NAME)->addTableBuilder(EtvaVlanPeer::TABLE_NAME, EtvaVlanPeer::getMapBuilder());
  751. //
  752. // Doing so will effectively overwrite the registration below.
  753.  
  754. Propel::getDatabaseMap(BaseEtvaVlanPeer::DATABASE_NAME)->addTableBuilder(BaseEtvaVlanPeer::TABLE_NAMEBaseEtvaVlanPeer::getMapBuilder());

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