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

Source for file BaseEtvaVolumegroupPeer.php

Documentation is available at BaseEtvaVolumegroupPeer.php

  1. <?php
  2.  
  3. /**
  4.  * Base static class for performing query and update operations on the 'volumegroup' 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 BaseEtvaVolumegroupPeer {
  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 'volumegroup';
  21.  
  22.     /** A class that can be returned by this peer. */
  23.     const CLASS_DEFAULT 'lib.model.EtvaVolumegroup';
  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 ID field */
  32.     const ID 'volumegroup.ID';
  33.  
  34.     /** the column name for the NODE_ID field */
  35.     const NODE_ID 'volumegroup.NODE_ID';
  36.  
  37.     /** the column name for the VG field */
  38.     const VG 'volumegroup.VG';
  39.  
  40.     /** the column name for the SIZE field */
  41.     const SIZE 'volumegroup.SIZE';
  42.  
  43.     /** the column name for the FREESIZE field */
  44.     const FREESIZE 'volumegroup.FREESIZE';
  45.  
  46.     /**
  47.      * An identiy map to hold any loaded instances of EtvaVolumegroup objects.
  48.      * This must be public so that other peer classes can access this when hydrating from JOIN
  49.      * queries.
  50.      * @var        array EtvaVolumegroup[]
  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 ('Id''NodeId''Vg''Size''Freesize'),
  68.         BasePeer::TYPE_STUDLYPHPNAME => array ('id''nodeId''vg''size''freesize'),
  69.         BasePeer::TYPE_COLNAME => array (self::IDself::NODE_IDself::VGself::SIZEself::FREESIZE),
  70.         BasePeer::TYPE_FIELDNAME => array ('id''node_id''vg''size''freesize'),
  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 ('Id' => 0'NodeId' => 1'Vg' => 2'Size' => 3'Freesize' => 4),
  82.         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0'nodeId' => 1'vg' => 2'size' => 3'freesize' => 4),
  83.         BasePeer::TYPE_COLNAME => array (self::ID => 0self::NODE_ID => 1self::VG => 2self::SIZE => 3self::FREESIZE => 4),
  84.         BasePeer::TYPE_FIELDNAME => array ('id' => 0'node_id' => 1'vg' => 2'size' => 3'freesize' => 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 EtvaVolumegroupMapBuilder();
  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. EtvaVolumegroupPeer::COLUMN_NAME).
  146.      * @return     string 
  147.      */
  148.     public static function alias($alias$column)
  149.     {
  150.         return str_replace(EtvaVolumegroupPeer::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(EtvaVolumegroupPeer::ID);
  168.  
  169.         $criteria->addSelectColumn(EtvaVolumegroupPeer::NODE_ID);
  170.  
  171.         $criteria->addSelectColumn(EtvaVolumegroupPeer::VG);
  172.  
  173.         $criteria->addSelectColumn(EtvaVolumegroupPeer::SIZE);
  174.  
  175.         $criteria->addSelectColumn(EtvaVolumegroupPeer::FREESIZE);
  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(EtvaVolumegroupPeer::TABLE_NAME);
  196.  
  197.         if ($distinct && !in_array(Criteria::DISTINCT$criteria->getSelectModifiers())) {
  198.             $criteria->setDistinct();
  199.         }
  200.  
  201.         if (!$criteria->hasSelectClause()) {
  202.             EtvaVolumegroupPeer::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(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  210.         }
  211.  
  212.  
  213.     foreach (sfMixer::getCallables('BaseEtvaVolumegroupPeer:doCount:doCount'as $callable)
  214.     {
  215.       call_user_func($callable'BaseEtvaVolumegroupPeer'$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     EtvaVolumegroup 
  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 EtvaVolumegroupPeer::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 EtvaVolumegroupPeer::populateObjects(EtvaVolumegroupPeer::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('BaseEtvaVolumegroupPeer:doSelectStmt:doSelectStmt'as $callable)
  279.     {
  280.       call_user_func($callable'BaseEtvaVolumegroupPeer'$criteria$con);
  281.     }
  282.  
  283.  
  284.         if ($con === null{
  285.             $con Propel::getConnection(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  286.         }
  287.  
  288.         if (!$criteria->hasSelectClause()) {
  289.             $criteria clone $criteria;
  290.             EtvaVolumegroupPeer::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      EtvaVolumegroup $value A EtvaVolumegroup 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(EtvaVolumegroup $obj$key null)
  312.     {
  313.         if (Propel::isInstancePoolingEnabled()) {
  314.             if ($key === null{
  315.                 $key = (string) $obj->getId();
  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 EtvaVolumegroup 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 EtvaVolumegroup{
  335.                 $key = (string) $value->getId();
  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 EtvaVolumegroup 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     EtvaVolumegroup 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 EtvaVolumegroupPeer::getOMClass();
  410.         $cls substr('.'.$clsstrrpos('.'.$cls'.'1);
  411.         // populate the object(s)
  412.         while ($row $stmt->fetch(PDO::FETCH_NUM)) {
  413.             $key EtvaVolumegroupPeer::getPrimaryKeyHashFromRow($row0);
  414.             if (null !== ($obj EtvaVolumegroupPeer::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.                 EtvaVolumegroupPeer::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 EtvaNode 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 doCountJoinEtvaNode(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(EtvaVolumegroupPeer::TABLE_NAME);
  449.  
  450.         if ($distinct && !in_array(Criteria::DISTINCT$criteria->getSelectModifiers())) {
  451.             $criteria->setDistinct();
  452.         }
  453.  
  454.         if (!$criteria->hasSelectClause()) {
  455.             EtvaVolumegroupPeer::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(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  465.         }
  466.  
  467.         $criteria->addJoin(array(EtvaVolumegroupPeer::NODE_ID,)array(EtvaNodePeer::ID,)$join_behavior);
  468.  
  469.  
  470.     foreach (sfMixer::getCallables('BaseEtvaVolumegroupPeer:doCount:doCount'as $callable)
  471.     {
  472.       call_user_func($callable'BaseEtvaVolumegroupPeer'$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 EtvaVolumegroup objects pre-filled with their EtvaNode 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 EtvaVolumegroup objects.
  494.      * @throws     PropelException Any exceptions caught during processing will be
  495.      *          rethrown wrapped into a PropelException.
  496.      */
  497.     public static function doSelectJoinEtvaNode(Criteria $c$con null$join_behavior Criteria::LEFT_JOIN)
  498.     {
  499.  
  500.     foreach (sfMixer::getCallables('BaseEtvaVolumegroupPeer:doSelectJoin:doSelectJoin'as $callable)
  501.     {
  502.       call_user_func($callable'BaseEtvaVolumegroupPeer'$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.         EtvaVolumegroupPeer::addSelectColumns($c);
  514.         $startcol (EtvaVolumegroupPeer::NUM_COLUMNS EtvaVolumegroupPeer::NUM_LAZY_LOAD_COLUMNS);
  515.         EtvaNodePeer::addSelectColumns($c);
  516.  
  517.         $c->addJoin(array(EtvaVolumegroupPeer::NODE_ID,)array(EtvaNodePeer::ID,)$join_behavior);
  518.         $stmt BasePeer::doSelect($c$con);
  519.         $results array();
  520.  
  521.         while ($row $stmt->fetch(PDO::FETCH_NUM)) {
  522.             $key1 EtvaVolumegroupPeer::getPrimaryKeyHashFromRow($row0);
  523.             if (null !== ($obj1 EtvaVolumegroupPeer::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 EtvaVolumegroupPeer::getOMClass();
  530.  
  531.                 $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  532.                 $obj1 new $cls();
  533.                 $obj1->hydrate($row);
  534.                 EtvaVolumegroupPeer::addInstanceToPool($obj1$key1);
  535.             // if $obj1 already loaded
  536.  
  537.             $key2 EtvaNodePeer::getPrimaryKeyHashFromRow($row$startcol);
  538.             if ($key2 !== null{
  539.                 $obj2 EtvaNodePeer::getInstanceFromPool($key2);
  540.                 if (!$obj2{
  541.  
  542.                     $omClass EtvaNodePeer::getOMClass();
  543.  
  544.                     $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  545.                     $obj2 new $cls();
  546.                     $obj2->hydrate($row$startcol);
  547.                     EtvaNodePeer::addInstanceToPool($obj2$key2);
  548.                 // if obj2 already loaded
  549.  
  550.                 // Add the $obj1 (EtvaVolumegroup) to $obj2 (EtvaNode)
  551.                 $obj2->addEtvaVolumegroup($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(EtvaVolumegroupPeer::TABLE_NAME);
  580.  
  581.         if ($distinct && !in_array(Criteria::DISTINCT$criteria->getSelectModifiers())) {
  582.             $criteria->setDistinct();
  583.         }
  584.  
  585.         if (!$criteria->hasSelectClause()) {
  586.             EtvaVolumegroupPeer::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(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  596.         }
  597.  
  598.         $criteria->addJoin(array(EtvaVolumegroupPeer::NODE_ID,)array(EtvaNodePeer::ID,)$join_behavior);
  599.  
  600.     foreach (sfMixer::getCallables('BaseEtvaVolumegroupPeer:doCount:doCount'as $callable)
  601.     {
  602.       call_user_func($callable'BaseEtvaVolumegroupPeer'$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 EtvaVolumegroup 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 EtvaVolumegroup 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('BaseEtvaVolumegroupPeer:doSelectJoinAll:doSelectJoinAll'as $callable)
  631.     {
  632.       call_user_func($callable'BaseEtvaVolumegroupPeer'$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.         EtvaVolumegroupPeer::addSelectColumns($c);
  644.         $startcol2 (EtvaVolumegroupPeer::NUM_COLUMNS EtvaVolumegroupPeer::NUM_LAZY_LOAD_COLUMNS);
  645.  
  646.         EtvaNodePeer::addSelectColumns($c);
  647.         $startcol3 $startcol2 (EtvaNodePeer::NUM_COLUMNS EtvaNodePeer::NUM_LAZY_LOAD_COLUMNS);
  648.  
  649.         $c->addJoin(array(EtvaVolumegroupPeer::NODE_ID,)array(EtvaNodePeer::ID,)$join_behavior);
  650.         $stmt BasePeer::doSelect($c$con);
  651.         $results array();
  652.  
  653.         while ($row $stmt->fetch(PDO::FETCH_NUM)) {
  654.             $key1 EtvaVolumegroupPeer::getPrimaryKeyHashFromRow($row0);
  655.             if (null !== ($obj1 EtvaVolumegroupPeer::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 EtvaVolumegroupPeer::getOMClass();
  661.  
  662.                 $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  663.                 $obj1 new $cls();
  664.                 $obj1->hydrate($row);
  665.                 EtvaVolumegroupPeer::addInstanceToPool($obj1$key1);
  666.             // if obj1 already loaded
  667.  
  668.             // Add objects for joined EtvaNode rows
  669.  
  670.             $key2 EtvaNodePeer::getPrimaryKeyHashFromRow($row$startcol2);
  671.             if ($key2 !== null{
  672.                 $obj2 EtvaNodePeer::getInstanceFromPool($key2);
  673.                 if (!$obj2{
  674.  
  675.                     $omClass EtvaNodePeer::getOMClass();
  676.  
  677.  
  678.                     $cls substr('.'.$omClassstrrpos('.'.$omClass'.'1);
  679.                     $obj2 new $cls();
  680.                     $obj2->hydrate($row$startcol2);
  681.                     EtvaNodePeer::addInstanceToPool($obj2$key2);
  682.                 // if obj2 loaded
  683.  
  684.                 // Add the $obj1 (EtvaVolumegroup) to the collection in $obj2 (EtvaNode)
  685.                 $obj2->addEtvaVolumegroup($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 EtvaVolumegroupPeer::CLASS_DEFAULT;
  723.     }
  724.  
  725.     /**
  726.      * Method perform an INSERT on the database, given a EtvaVolumegroup or Criteria object.
  727.      *
  728.      * @param      mixed $values Criteria or EtvaVolumegroup 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('BaseEtvaVolumegroupPeer:doInsert:pre'as $callable)
  738.     {
  739.       $ret call_user_func($callable'BaseEtvaVolumegroupPeer'$values$con);
  740.       if (false !== $ret)
  741.       {
  742.         return $ret;
  743.       }
  744.     }
  745.  
  746.  
  747.         if ($con === null{
  748.             $con Propel::getConnection(EtvaVolumegroupPeer::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 EtvaVolumegroup object
  755.         }
  756.  
  757.         if ($criteria->containsKey(EtvaVolumegroupPeer::ID&& $criteria->keyContainsValue(EtvaVolumegroupPeer::ID) ) {
  758.             throw new PropelException('Cannot insert a value for auto-increment primary key ('.EtvaVolumegroupPeer::ID.')');
  759.         }
  760.  
  761.  
  762.         // Set the correct dbName
  763.         $criteria->setDbName(self::DATABASE_NAME);
  764.  
  765.         try {
  766.             // use transaction because $criteria could contain info
  767.             // for more than one table (I guess, conceivably)
  768.             $con->beginTransaction();
  769.             $pk BasePeer::doInsert($criteria$con);
  770.             $con->commit();
  771.         catch(PropelException $e{
  772.             $con->rollBack();
  773.             throw $e;
  774.         }
  775.  
  776.         
  777.     foreach (sfMixer::getCallables('BaseEtvaVolumegroupPeer:doInsert:post'as $callable)
  778.     {
  779.       call_user_func($callable'BaseEtvaVolumegroupPeer'$values$con$pk);
  780.     }
  781.  
  782.     return $pk;
  783.     }
  784.  
  785.     /**
  786.      * Method perform an UPDATE on the database, given a EtvaVolumegroup or Criteria object.
  787.      *
  788.      * @param      mixed $values Criteria or EtvaVolumegroup object containing data that is used to create the UPDATE statement.
  789.      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
  790.      * @return     int The number of affected rows (if supported by underlying database driver).
  791.      * @throws     PropelException Any exceptions caught during processing will be
  792.      *          rethrown wrapped into a PropelException.
  793.      */
  794.     public static function doUpdate($valuesPropelPDO $con null)
  795.     {
  796.  
  797.     foreach (sfMixer::getCallables('BaseEtvaVolumegroupPeer:doUpdate:pre'as $callable)
  798.     {
  799.       $ret call_user_func($callable'BaseEtvaVolumegroupPeer'$values$con);
  800.       if (false !== $ret)
  801.       {
  802.         return $ret;
  803.       }
  804.     }
  805.  
  806.  
  807.         if ($con === null{
  808.             $con Propel::getConnection(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  809.         }
  810.  
  811.         $selectCriteria new Criteria(self::DATABASE_NAME);
  812.  
  813.         if ($values instanceof Criteria{
  814.             $criteria clone $values// rename for clarity
  815.  
  816.             $comparison $criteria->getComparison(EtvaVolumegroupPeer::ID);
  817.             $selectCriteria->add(EtvaVolumegroupPeer::ID$criteria->remove(EtvaVolumegroupPeer::ID)$comparison);
  818.  
  819.         else // $values is EtvaVolumegroup object
  820.             $criteria $values->buildCriteria()// gets full criteria
  821.             $selectCriteria $values->buildPkeyCriteria()// gets criteria w/ primary key(s)
  822.         }
  823.  
  824.         // set the correct dbName
  825.         $criteria->setDbName(self::DATABASE_NAME);
  826.  
  827.         $ret BasePeer::doUpdate($selectCriteria$criteria$con);
  828.     
  829.  
  830.     foreach (sfMixer::getCallables('BaseEtvaVolumegroupPeer:doUpdate:post'as $callable)
  831.     {
  832.       call_user_func($callable'BaseEtvaVolumegroupPeer'$values$con$ret);
  833.     }
  834.  
  835.     return $ret;
  836.   }
  837.  
  838.     /**
  839.      * Method to DELETE all rows from the volumegroup table.
  840.      *
  841.      * @return     int The number of affected rows (if supported by underlying database driver).
  842.      */
  843.     public static function doDeleteAll($con null)
  844.     {
  845.         if ($con === null{
  846.             $con Propel::getConnection(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  847.         }
  848.         $affectedRows 0// initialize var to track total num of affected rows
  849.         try {
  850.             // use transaction because $criteria could contain info
  851.             // for more than one table or we could emulating ON DELETE CASCADE, etc.
  852.             $con->beginTransaction();
  853.             $affectedRows += BasePeer::doDeleteAll(EtvaVolumegroupPeer::TABLE_NAME$con);
  854.             $con->commit();
  855.             return $affectedRows;
  856.         catch (PropelException $e{
  857.             $con->rollBack();
  858.             throw $e;
  859.         }
  860.     }
  861.  
  862.     /**
  863.      * Method perform a DELETE on the database, given a EtvaVolumegroup or Criteria object OR a primary key value.
  864.      *
  865.      * @param      mixed $values Criteria or EtvaVolumegroup object or primary key or array of primary keys
  866.      *               which is used to create the DELETE statement
  867.      * @param      PropelPDO $con the connection to use
  868.      * @return     int     The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
  869.      *                 if supported by native driver or if emulated using Propel.
  870.      * @throws     PropelException Any exceptions caught during processing will be
  871.      *          rethrown wrapped into a PropelException.
  872.      */
  873.      public static function doDelete($valuesPropelPDO $con null)
  874.      {
  875.         if ($con === null{
  876.             $con Propel::getConnection(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  877.         }
  878.  
  879.         if ($values instanceof Criteria{
  880.             // invalidate the cache for all objects of this type, since we have no
  881.             // way of knowing (without running a query) what objects should be invalidated
  882.             // from the cache based on this Criteria.
  883.             EtvaVolumegroupPeer::clearInstancePool();
  884.  
  885.             // rename for clarity
  886.             $criteria clone $values;
  887.         elseif ($values instanceof EtvaVolumegroup{
  888.             // invalidate the cache for this single object
  889.             EtvaVolumegroupPeer::removeInstanceFromPool($values);
  890.             // create criteria based on pk values
  891.             $criteria $values->buildPkeyCriteria();
  892.         else {
  893.             // it must be the primary key
  894.  
  895.  
  896.  
  897.             $criteria new Criteria(self::DATABASE_NAME);
  898.             $criteria->add(EtvaVolumegroupPeer::ID(array) $valuesCriteria::IN);
  899.  
  900.             foreach ((array) $values as $singleval{
  901.                 // we can invalidate the cache for this single object
  902.                 EtvaVolumegroupPeer::removeInstanceFromPool($singleval);
  903.             }
  904.         }
  905.  
  906.         // Set the correct dbName
  907.         $criteria->setDbName(self::DATABASE_NAME);
  908.  
  909.         $affectedRows 0// initialize var to track total num of affected rows
  910.  
  911.         try {
  912.             // use transaction because $criteria could contain info
  913.             // for more than one table or we could emulating ON DELETE CASCADE, etc.
  914.             $con->beginTransaction();
  915.             
  916.             $affectedRows += BasePeer::doDelete($criteria$con);
  917.  
  918.             $con->commit();
  919.             return $affectedRows;
  920.         catch (PropelException $e{
  921.             $con->rollBack();
  922.             throw $e;
  923.         }
  924.     }
  925.  
  926.     /**
  927.      * Validates all modified columns of given EtvaVolumegroup object.
  928.      * If parameter $columns is either a single column name or an array of column names
  929.      * than only those columns are validated.
  930.      *
  931.      * NOTICE: This does not apply to primary or foreign keys for now.
  932.      *
  933.      * @param      EtvaVolumegroup $obj The object to validate.
  934.      * @param      mixed $cols Column name or array of column names.
  935.      *
  936.      * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
  937.      */
  938.     public static function doValidate(EtvaVolumegroup $obj$cols null)
  939.     {
  940.         $columns array();
  941.  
  942.         if ($cols{
  943.             $dbMap Propel::getDatabaseMap(EtvaVolumegroupPeer::DATABASE_NAME);
  944.             $tableMap $dbMap->getTable(EtvaVolumegroupPeer::TABLE_NAME);
  945.  
  946.             if (is_array($cols)) {
  947.                 $cols array($cols);
  948.             }
  949.  
  950.             foreach ($cols as $colName{
  951.                 if ($tableMap->containsColumn($colName)) {
  952.                     $get 'get' $tableMap->getColumn($colName)->getPhpName();
  953.                     $columns[$colName$obj->$get();
  954.                 }
  955.             }
  956.         else {
  957.  
  958.         }
  959.  
  960.         $res =  BasePeer::doValidate(EtvaVolumegroupPeer::DATABASE_NAMEEtvaVolumegroupPeer::TABLE_NAME$columns);
  961.     if ($res !== true{
  962.         $request sfContext::getInstance()->getRequest();
  963.         foreach ($res as $failed{
  964.             $col EtvaVolumegroupPeer::translateFieldname($failed->getColumn()BasePeer::TYPE_COLNAMEBasePeer::TYPE_PHPNAME);
  965.         }
  966.     }
  967.  
  968.     return $res;
  969.     }
  970.  
  971.     /**
  972.      * Retrieve a single object by pkey.
  973.      *
  974.      * @param      int $pk the primary key.
  975.      * @param      PropelPDO $con the connection to use
  976.      * @return     EtvaVolumegroup 
  977.      */
  978.     public static function retrieveByPK($pkPropelPDO $con null)
  979.     {
  980.  
  981.         if (null !== ($obj EtvaVolumegroupPeer::getInstanceFromPool((string) $pk))) {
  982.             return $obj;
  983.         }
  984.  
  985.         if ($con === null{
  986.             $con Propel::getConnection(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  987.         }
  988.  
  989.         $criteria new Criteria(EtvaVolumegroupPeer::DATABASE_NAME);
  990.         $criteria->add(EtvaVolumegroupPeer::ID$pk);
  991.  
  992.         $v EtvaVolumegroupPeer::doSelect($criteria$con);
  993.  
  994.         return !empty($v$v[0null;
  995.     }
  996.  
  997.     /**
  998.      * Retrieve multiple objects by pkey.
  999.      *
  1000.      * @param      array $pks List of primary keys
  1001.      * @param      PropelPDO $con the connection to use
  1002.      * @throws     PropelException Any exceptions caught during processing will be
  1003.      *          rethrown wrapped into a PropelException.
  1004.      */
  1005.     public static function retrieveByPKs($pksPropelPDO $con null)
  1006.     {
  1007.         if ($con === null{
  1008.             $con Propel::getConnection(EtvaVolumegroupPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  1009.         }
  1010.  
  1011.         $objs null;
  1012.         if (empty($pks)) {
  1013.             $objs array();
  1014.         else {
  1015.             $criteria new Criteria(EtvaVolumegroupPeer::DATABASE_NAME);
  1016.             $criteria->add(EtvaVolumegroupPeer::ID$pksCriteria::IN);
  1017.             $objs EtvaVolumegroupPeer::doSelect($criteria$con);
  1018.         }
  1019.         return $objs;
  1020.     }
  1021.  
  1022. // BaseEtvaVolumegroupPeer
  1023.  
  1024. // This is the static code needed to register the MapBuilder for this table with the main Propel class.
  1025. //
  1026. // NOTE: This static code cannot call methods on the EtvaVolumegroupPeer class, because it is not defined yet.
  1027. // If you need to use overridden methods, you can add this code to the bottom of the EtvaVolumegroupPeer class:
  1028. //
  1029. // Propel::getDatabaseMap(EtvaVolumegroupPeer::DATABASE_NAME)->addTableBuilder(EtvaVolumegroupPeer::TABLE_NAME, EtvaVolumegroupPeer::getMapBuilder());
  1030. //
  1031. // Doing so will effectively overwrite the registration below.
  1032.  
  1033. Propel::getDatabaseMap(BaseEtvaVolumegroupPeer::DATABASE_NAME)->addTableBuilder(BaseEtvaVolumegroupPeer::TABLE_NAMEBaseEtvaVolumegroupPeer::getMapBuilder());

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