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

Source for file BaseEtvaNetworkPeer.php

Documentation is available at BaseEtvaNetworkPeer.php

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

Documentation generated on Fri, 19 Jun 2009 10:47:02 +0100 by phpDocumentor 1.4.2