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

Source for file BaseEtvaNetwork.php

Documentation is available at BaseEtvaNetwork.php

  1. <?php
  2.  
  3. /**
  4.  * Base class that represents a row from 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 BaseEtvaNetwork extends BaseObject  implements Persistent {
  15.  
  16.  
  17.   const PEER = 'EtvaNetworkPeer';
  18.  
  19.     /**
  20.      * The Peer class.
  21.      * Instance provides a convenient way of calling static methods on a class
  22.      * that calling code may not be able to identify.
  23.      * @var        EtvaNetworkPeer 
  24.      */
  25.     protected static $peer;
  26.  
  27.     /**
  28.      * The value for the id field.
  29.      * @var        int 
  30.      */
  31.     protected $id;
  32.  
  33.     /**
  34.      * The value for the server_id field.
  35.      * @var        int 
  36.      */
  37.     protected $server_id;
  38.  
  39.     /**
  40.      * The value for the port field.
  41.      * @var        string 
  42.      */
  43.     protected $port;
  44.  
  45.     /**
  46.      * The value for the ip field.
  47.      * @var        string 
  48.      */
  49.     protected $ip;
  50.  
  51.     /**
  52.      * The value for the mask field.
  53.      * @var        string 
  54.      */
  55.     protected $mask;
  56.  
  57.     /**
  58.      * The value for the mac field.
  59.      * @var        string 
  60.      */
  61.     protected $mac;
  62.  
  63.     /**
  64.      * The value for the vlan field.
  65.      * @var        string 
  66.      */
  67.     protected $vlan;
  68.  
  69.     /**
  70.      * @var        EtvaServer 
  71.      */
  72.     protected $aEtvaServer;
  73.  
  74.     /**
  75.      * Flag to prevent endless save loop, if this object is referenced
  76.      * by another object which falls in this transaction.
  77.      * @var        boolean 
  78.      */
  79.     protected $alreadyInSave = false;
  80.  
  81.     /**
  82.      * Flag to prevent endless validation loop, if this object is referenced
  83.      * by another object which falls in this transaction.
  84.      * @var        boolean 
  85.      */
  86.     protected $alreadyInValidation = false;
  87.  
  88.     /**
  89.      * Initializes internal state of BaseEtvaNetwork object.
  90.      * @see        applyDefaults()
  91.      */
  92.     public function __construct()
  93.     {
  94.         parent::__construct();
  95.         $this->applyDefaultValues();
  96.     }
  97.  
  98.     /**
  99.      * Applies default values to this object.
  100.      * This method should be called from the object's constructor (or
  101.      * equivalent initialization method).
  102.      * @see        __construct()
  103.      */
  104.     public function applyDefaultValues()
  105.     {
  106.     }
  107.  
  108.     /**
  109.      * Get the [id] column value.
  110.      * 
  111.      * @return     int 
  112.      */
  113.     public function getId()
  114.     {
  115.         return $this->id;
  116.     }
  117.  
  118.     /**
  119.      * Get the [server_id] column value.
  120.      * 
  121.      * @return     int 
  122.      */
  123.     public function getServerId()
  124.     {
  125.         return $this->server_id;
  126.     }
  127.  
  128.     /**
  129.      * Get the [port] column value.
  130.      * 
  131.      * @return     string 
  132.      */
  133.     public function getPort()
  134.     {
  135.         return $this->port;
  136.     }
  137.  
  138.     /**
  139.      * Get the [ip] column value.
  140.      * 
  141.      * @return     string 
  142.      */
  143.     public function getIp()
  144.     {
  145.         return $this->ip;
  146.     }
  147.  
  148.     /**
  149.      * Get the [mask] column value.
  150.      * 
  151.      * @return     string 
  152.      */
  153.     public function getMask()
  154.     {
  155.         return $this->mask;
  156.     }
  157.  
  158.     /**
  159.      * Get the [mac] column value.
  160.      * 
  161.      * @return     string 
  162.      */
  163.     public function getMac()
  164.     {
  165.         return $this->mac;
  166.     }
  167.  
  168.     /**
  169.      * Get the [vlan] column value.
  170.      * 
  171.      * @return     string 
  172.      */
  173.     public function getVlan()
  174.     {
  175.         return $this->vlan;
  176.     }
  177.  
  178.     /**
  179.      * Set the value of [id] column.
  180.      * 
  181.      * @param      int $v new value
  182.      * @return     EtvaNetwork The current object (for fluent API support)
  183.      */
  184.     public function setId($v)
  185.     {
  186.         if ($v !== null{
  187.             $v = (int) $v;
  188.         }
  189.  
  190.         if ($this->id !== $v{
  191.             $this->id = $v;
  192.             $this->modifiedColumns[EtvaNetworkPeer::ID;
  193.         }
  194.  
  195.         return $this;
  196.     // setId()
  197.  
  198.     /**
  199.      * Set the value of [server_id] column.
  200.      * 
  201.      * @param      int $v new value
  202.      * @return     EtvaNetwork The current object (for fluent API support)
  203.      */
  204.     public function setServerId($v)
  205.     {
  206.         if ($v !== null{
  207.             $v = (int) $v;
  208.         }
  209.  
  210.         if ($this->server_id !== $v{
  211.             $this->server_id = $v;
  212.             $this->modifiedColumns[EtvaNetworkPeer::SERVER_ID;
  213.         }
  214.  
  215.         if ($this->aEtvaServer !== null && $this->aEtvaServer->getId(!== $v{
  216.             $this->aEtvaServer = null;
  217.         }
  218.  
  219.         return $this;
  220.     // setServerId()
  221.  
  222.     /**
  223.      * Set the value of [port] column.
  224.      * 
  225.      * @param      string $v new value
  226.      * @return     EtvaNetwork The current object (for fluent API support)
  227.      */
  228.     public function setPort($v)
  229.     {
  230.         if ($v !== null{
  231.             $v = (string) $v;
  232.         }
  233.  
  234.         if ($this->port !== $v{
  235.             $this->port = $v;
  236.             $this->modifiedColumns[EtvaNetworkPeer::PORT;
  237.         }
  238.  
  239.         return $this;
  240.     // setPort()
  241.  
  242.     /**
  243.      * Set the value of [ip] column.
  244.      * 
  245.      * @param      string $v new value
  246.      * @return     EtvaNetwork The current object (for fluent API support)
  247.      */
  248.     public function setIp($v)
  249.     {
  250.         if ($v !== null{
  251.             $v = (string) $v;
  252.         }
  253.  
  254.         if ($this->ip !== $v{
  255.             $this->ip = $v;
  256.             $this->modifiedColumns[EtvaNetworkPeer::IP;
  257.         }
  258.  
  259.         return $this;
  260.     // setIp()
  261.  
  262.     /**
  263.      * Set the value of [mask] column.
  264.      * 
  265.      * @param      string $v new value
  266.      * @return     EtvaNetwork The current object (for fluent API support)
  267.      */
  268.     public function setMask($v)
  269.     {
  270.         if ($v !== null{
  271.             $v = (string) $v;
  272.         }
  273.  
  274.         if ($this->mask !== $v{
  275.             $this->mask = $v;
  276.             $this->modifiedColumns[EtvaNetworkPeer::MASK;
  277.         }
  278.  
  279.         return $this;
  280.     // setMask()
  281.  
  282.     /**
  283.      * Set the value of [mac] column.
  284.      * 
  285.      * @param      string $v new value
  286.      * @return     EtvaNetwork The current object (for fluent API support)
  287.      */
  288.     public function setMac($v)
  289.     {
  290.         if ($v !== null{
  291.             $v = (string) $v;
  292.         }
  293.  
  294.         if ($this->mac !== $v{
  295.             $this->mac = $v;
  296.             $this->modifiedColumns[EtvaNetworkPeer::MAC;
  297.         }
  298.  
  299.         return $this;
  300.     // setMac()
  301.  
  302.     /**
  303.      * Set the value of [vlan] column.
  304.      * 
  305.      * @param      string $v new value
  306.      * @return     EtvaNetwork The current object (for fluent API support)
  307.      */
  308.     public function setVlan($v)
  309.     {
  310.         if ($v !== null{
  311.             $v = (string) $v;
  312.         }
  313.  
  314.         if ($this->vlan !== $v{
  315.             $this->vlan = $v;
  316.             $this->modifiedColumns[EtvaNetworkPeer::VLAN;
  317.         }
  318.  
  319.         return $this;
  320.     // setVlan()
  321.  
  322.     /**
  323.      * Indicates whether the columns in this object are only set to default values.
  324.      *
  325.      * This method can be used in conjunction with isModified() to indicate whether an object is both
  326.      * modified _and_ has some values set which are non-default.
  327.      *
  328.      * @return     boolean Whether the columns in this object are only been set with default values.
  329.      */
  330.     public function hasOnlyDefaultValues()
  331.     {
  332.             // First, ensure that we don't have any columns that have been modified which aren't default columns.
  333.             if (array_diff($this->modifiedColumnsarray())) {
  334.                 return false;
  335.             }
  336.  
  337.         // otherwise, everything was equal, so return TRUE
  338.         return true;
  339.     // hasOnlyDefaultValues()
  340.  
  341.     /**
  342.      * Hydrates (populates) the object variables with values from the database resultset.
  343.      *
  344.      * An offset (0-based "start column") is specified so that objects can be hydrated
  345.      * with a subset of the columns in the resultset rows.  This is needed, for example,
  346.      * for results of JOIN queries where the resultset row includes columns from two or
  347.      * more tables.
  348.      *
  349.      * @param      array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  350.      * @param      int $startcol 0-based offset column which indicates which restultset column to start with.
  351.      * @param      boolean $rehydrate Whether this object is being re-hydrated from the database.
  352.      * @return     int next starting column
  353.      * @throws     PropelException  - Any caught Exception will be rewrapped as a PropelException.
  354.      */
  355.     public function hydrate($row$startcol 0$rehydrate false)
  356.     {
  357.         try {
  358.  
  359.             $this->id = ($row[$startcol 0!== null? (int) $row[$startcol 0null;
  360.             $this->server_id = ($row[$startcol 1!== null? (int) $row[$startcol 1null;
  361.             $this->port = ($row[$startcol 2!== null? (string) $row[$startcol 2null;
  362.             $this->ip = ($row[$startcol 3!== null? (string) $row[$startcol 3null;
  363.             $this->mask = ($row[$startcol 4!== null? (string) $row[$startcol 4null;
  364.             $this->mac = ($row[$startcol 5!== null? (string) $row[$startcol 5null;
  365.             $this->vlan = ($row[$startcol 6!== null? (string) $row[$startcol 6null;
  366.             $this->resetModified();
  367.  
  368.             $this->setNew(false);
  369.  
  370.             if ($rehydrate{
  371.                 $this->ensureConsistency();
  372.             }
  373.  
  374.             // FIXME - using NUM_COLUMNS may be clearer.
  375.             return $startcol 7// 7 = EtvaNetworkPeer::NUM_COLUMNS - EtvaNetworkPeer::NUM_LAZY_LOAD_COLUMNS).
  376.  
  377.         catch (Exception $e{
  378.             throw new PropelException("Error populating EtvaNetwork object"$e);
  379.         }
  380.     }
  381.  
  382.     /**
  383.      * Checks and repairs the internal consistency of the object.
  384.      *
  385.      * This method is executed after an already-instantiated object is re-hydrated
  386.      * from the database.  It exists to check any foreign keys to make sure that
  387.      * the objects related to the current object are correct based on foreign key.
  388.      *
  389.      * You can override this method in the stub class, but you should always invoke
  390.      * the base method from the overridden method (i.e. parent::ensureConsistency()),
  391.      * in case your model changes.
  392.      *
  393.      * @throws     PropelException
  394.      */
  395.     public function ensureConsistency()
  396.     {
  397.  
  398.         if ($this->aEtvaServer !== null && $this->server_id !== $this->aEtvaServer->getId()) {
  399.             $this->aEtvaServer = null;
  400.         }
  401.     // ensureConsistency
  402.  
  403.     /**
  404.      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  405.      *
  406.      * This will only work if the object has been saved and has a valid primary key set.
  407.      *
  408.      * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  409.      * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  410.      * @return     void 
  411.      * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  412.      */
  413.     public function reload($deep falsePropelPDO $con null)
  414.     {
  415.         if ($this->isDeleted()) {
  416.             throw new PropelException("Cannot reload a deleted object.");
  417.         }
  418.  
  419.         if ($this->isNew()) {
  420.             throw new PropelException("Cannot reload an unsaved object.");
  421.         }
  422.  
  423.         if ($con === null{
  424.             $con Propel::getConnection(EtvaNetworkPeer::DATABASE_NAMEPropel::CONNECTION_READ);
  425.         }
  426.  
  427.         // We don't need to alter the object instance pool; we're just modifying this instance
  428.         // already in the pool.
  429.  
  430.         $stmt EtvaNetworkPeer::doSelectStmt($this->buildPkeyCriteria()$con);
  431.         $row $stmt->fetch(PDO::FETCH_NUM);
  432.         $stmt->closeCursor();
  433.         if (!$row{
  434.             throw new PropelException('Cannot find matching row in the database to reload object values.');
  435.         }
  436.         $this->hydrate($row0true)// rehydrate
  437.  
  438.         if ($deep{  // also de-associate any related objects?
  439.  
  440.             $this->aEtvaServer = null;
  441.         // if (deep)
  442.     }
  443.  
  444.     /**
  445.      * Removes this object from datastore and sets delete attribute.
  446.      *
  447.      * @param      PropelPDO $con 
  448.      * @return     void 
  449.      * @throws     PropelException
  450.      * @see        BaseObject::setDeleted()
  451.      * @see        BaseObject::isDeleted()
  452.      */
  453.     public function delete(PropelPDO $con null)
  454.     {
  455.  
  456.     foreach (sfMixer::getCallables('BaseEtvaNetwork:delete:pre'as $callable)
  457.     {
  458.       $ret call_user_func($callable$this$con);
  459.       if ($ret)
  460.       {
  461.         return;
  462.       }
  463.     }
  464.  
  465.  
  466.         if ($this->isDeleted()) {
  467.             throw new PropelException("This object has already been deleted.");
  468.         }
  469.  
  470.         if ($con === null{
  471.             $con Propel::getConnection(EtvaNetworkPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  472.         }
  473.         
  474.         $con->beginTransaction();
  475.         try {
  476.             EtvaNetworkPeer::doDelete($this$con);
  477.             $this->setDeleted(true);
  478.             $con->commit();
  479.         catch (PropelException $e{
  480.             $con->rollBack();
  481.             throw $e;
  482.         }
  483.     
  484.  
  485.     foreach (sfMixer::getCallables('BaseEtvaNetwork:delete:post'as $callable)
  486.     {
  487.       call_user_func($callable$this$con);
  488.     }
  489.  
  490.   }
  491.     /**
  492.      * Persists this object to the database.
  493.      *
  494.      * If the object is new, it inserts it; otherwise an update is performed.
  495.      * All modified related objects will also be persisted in the doSave()
  496.      * method.  This method wraps all precipitate database operations in a
  497.      * single transaction.
  498.      *
  499.      * @param      PropelPDO $con 
  500.      * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  501.      * @throws     PropelException
  502.      * @see        doSave()
  503.      */
  504.     public function save(PropelPDO $con null)
  505.     {
  506.  
  507.     foreach (sfMixer::getCallables('BaseEtvaNetwork:save:pre'as $callable)
  508.     {
  509.       $affectedRows call_user_func($callable$this$con);
  510.       if (is_int($affectedRows))
  511.       {
  512.         return $affectedRows;
  513.       }
  514.     }
  515.  
  516.  
  517.         if ($this->isDeleted()) {
  518.             throw new PropelException("You cannot save an object that has been deleted.");
  519.         }
  520.  
  521.         if ($con === null{
  522.             $con Propel::getConnection(EtvaNetworkPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  523.         }
  524.         
  525.         $con->beginTransaction();
  526.         try {
  527.             $affectedRows $this->doSave($con);
  528.             $con->commit();
  529.     foreach (sfMixer::getCallables('BaseEtvaNetwork:save:post'as $callable)
  530.     {
  531.       call_user_func($callable$this$con$affectedRows);
  532.     }
  533.  
  534.             EtvaNetworkPeer::addInstanceToPool($this);
  535.             return $affectedRows;
  536.         catch (PropelException $e{
  537.             $con->rollBack();
  538.             throw $e;
  539.         }
  540.     }
  541.  
  542.     /**
  543.      * Performs the work of inserting or updating the row in the database.
  544.      *
  545.      * If the object is new, it inserts it; otherwise an update is performed.
  546.      * All related objects are also updated in this method.
  547.      *
  548.      * @param      PropelPDO $con 
  549.      * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  550.      * @throws     PropelException
  551.      * @see        save()
  552.      */
  553.     protected function doSave(PropelPDO $con)
  554.     {
  555.         $affectedRows 0// initialize var to track total num of affected rows
  556.         if (!$this->alreadyInSave{
  557.             $this->alreadyInSave = true;
  558.  
  559.             // We call the save method on the following object(s) if they
  560.             // were passed to this object by their coresponding set
  561.             // method.  This object relates to these object(s) by a
  562.             // foreign key reference.
  563.  
  564.             if ($this->aEtvaServer !== null{
  565.                 if ($this->aEtvaServer->isModified(|| $this->aEtvaServer->isNew()) {
  566.                     $affectedRows += $this->aEtvaServer->save($con);
  567.                 }
  568.                 $this->setEtvaServer($this->aEtvaServer);
  569.             }
  570.  
  571.             if ($this->isNew() ) {
  572.                 $this->modifiedColumns[EtvaNetworkPeer::ID;
  573.             }
  574.  
  575.             // If this object has been modified, then save it to the database.
  576.             if ($this->isModified()) {
  577.                 if ($this->isNew()) {
  578.                     $pk EtvaNetworkPeer::doInsert($this$con);
  579.                     $affectedRows += 1// we are assuming that there is only 1 row per doInsert() which
  580.                                          // should always be true here (even though technically
  581.                                          // BasePeer::doInsert() can insert multiple rows).
  582.  
  583.                     $this->setId($pk);  //[IMV] update autoincrement primary key
  584.  
  585.                     $this->setNew(false);
  586.                 else {
  587.                     $affectedRows += EtvaNetworkPeer::doUpdate($this$con);
  588.                 }
  589.  
  590.                 $this->resetModified()// [HL] After being saved an object is no longer 'modified'
  591.             }
  592.  
  593.             $this->alreadyInSave = false;
  594.  
  595.         }
  596.         return $affectedRows;
  597.     // doSave()
  598.  
  599.     /**
  600.      * Array of ValidationFailed objects.
  601.      * @var        array ValidationFailed[]
  602.      */
  603.     protected $validationFailures = array();
  604.  
  605.     /**
  606.      * Gets any ValidationFailed objects that resulted from last call to validate().
  607.      *
  608.      *
  609.      * @return     array ValidationFailed[]
  610.      * @see        validate()
  611.      */
  612.     public function getValidationFailures()
  613.     {
  614.         return $this->validationFailures;
  615.     }
  616.  
  617.     /**
  618.      * Validates the objects modified field values and all objects related to this table.
  619.      *
  620.      * If $columns is either a column name or an array of column names
  621.      * only those columns are validated.
  622.      *
  623.      * @param      mixed $columns Column name or an array of column names.
  624.      * @return     boolean Whether all columns pass validation.
  625.      * @see        doValidate()
  626.      * @see        getValidationFailures()
  627.      */
  628.     public function validate($columns null)
  629.     {
  630.         $res $this->doValidate($columns);
  631.         if ($res === true{
  632.             $this->validationFailures = array();
  633.             return true;
  634.         else {
  635.             $this->validationFailures = $res;
  636.             return false;
  637.         }
  638.     }
  639.  
  640.     /**
  641.      * This function performs the validation work for complex object models.
  642.      *
  643.      * In addition to checking the current object, all related objects will
  644.      * also be validated.  If all pass then <code>true</code> is returned; otherwise
  645.      * an aggreagated array of ValidationFailed objects will be returned.
  646.      *
  647.      * @param      array $columns Array of column names to validate.
  648.      * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  649.      */
  650.     protected function doValidate($columns null)
  651.     {
  652.         if (!$this->alreadyInValidation{
  653.             $this->alreadyInValidation = true;
  654.             $retval null;
  655.  
  656.             $failureMap array();
  657.  
  658.  
  659.             // We call the validate method on the following object(s) if they
  660.             // were passed to this object by their coresponding set
  661.             // method.  This object relates to these object(s) by a
  662.             // foreign key reference.
  663.  
  664.             if ($this->aEtvaServer !== null{
  665.                 if (!$this->aEtvaServer->validate($columns)) {
  666.                     $failureMap array_merge($failureMap$this->aEtvaServer->getValidationFailures());
  667.                 }
  668.             }
  669.  
  670.  
  671.             if (($retval EtvaNetworkPeer::doValidate($this$columns)) !== true{
  672.                 $failureMap array_merge($failureMap$retval);
  673.             }
  674.  
  675.  
  676.  
  677.             $this->alreadyInValidation = false;
  678.         }
  679.  
  680.         return (!empty($failureMap$failureMap true);
  681.     }
  682.  
  683.     /**
  684.      * Retrieves a field from the object by name passed in as a string.
  685.      *
  686.      * @param      string $name name
  687.      * @param      string $type The type of fieldname the $name is of:
  688.      *                      one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  689.      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  690.      * @return     mixed Value of field.
  691.      */
  692.     public function getByName($name$type BasePeer::TYPE_PHPNAME)
  693.     {
  694.         $pos EtvaNetworkPeer::translateFieldName($name$typeBasePeer::TYPE_NUM);
  695.         $field $this->getByPosition($pos);
  696.         return $field;
  697.     }
  698.  
  699.     /**
  700.      * Retrieves a field from the object by Position as specified in the xml schema.
  701.      * Zero-based.
  702.      *
  703.      * @param      int $pos position in xml schema
  704.      * @return     mixed Value of field at $pos
  705.      */
  706.     public function getByPosition($pos)
  707.     {
  708.         switch($pos{
  709.             case 0:
  710.                 return $this->getId();
  711.                 break;
  712.             case 1:
  713.                 return $this->getServerId();
  714.                 break;
  715.             case 2:
  716.                 return $this->getPort();
  717.                 break;
  718.             case 3:
  719.                 return $this->getIp();
  720.                 break;
  721.             case 4:
  722.                 return $this->getMask();
  723.                 break;
  724.             case 5:
  725.                 return $this->getMac();
  726.                 break;
  727.             case 6:
  728.                 return $this->getVlan();
  729.                 break;
  730.             default:
  731.                 return null;
  732.                 break;
  733.         // switch()
  734.     }
  735.  
  736.     /**
  737.      * Exports the object as an array.
  738.      *
  739.      * You can specify the key type of the array by passing one of the class
  740.      * type constants.
  741.      *
  742.      * @param      string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  743.      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
  744.      * @param      boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns.  Defaults to TRUE.
  745.      * @return     an associative array containing the field names (as keys) and field values
  746.      */
  747.     public function toArray($keyType BasePeer::TYPE_PHPNAME$includeLazyLoadColumns true)
  748.     {
  749.         $keys EtvaNetworkPeer::getFieldNames($keyType);
  750.         $result array(
  751.             $keys[0=> $this->getId(),
  752.             $keys[1=> $this->getServerId(),
  753.             $keys[2=> $this->getPort(),
  754.             $keys[3=> $this->getIp(),
  755.             $keys[4=> $this->getMask(),
  756.             $keys[5=> $this->getMac(),
  757.             $keys[6=> $this->getVlan(),
  758.         );
  759.         return $result;
  760.     }
  761.  
  762.     /**
  763.      * Sets a field from the object by name passed in as a string.
  764.      *
  765.      * @param      string $name peer name
  766.      * @param      mixed $value field value
  767.      * @param      string $type The type of fieldname the $name is of:
  768.      *                      one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  769.      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  770.      * @return     void 
  771.      */
  772.     public function setByName($name$value$type BasePeer::TYPE_PHPNAME)
  773.     {
  774.         $pos EtvaNetworkPeer::translateFieldName($name$typeBasePeer::TYPE_NUM);
  775.         return $this->setByPosition($pos$value);
  776.     }
  777.  
  778.     /**
  779.      * Sets a field from the object by Position as specified in the xml schema.
  780.      * Zero-based.
  781.      *
  782.      * @param      int $pos position in xml schema
  783.      * @param      mixed $value field value
  784.      * @return     void 
  785.      */
  786.     public function setByPosition($pos$value)
  787.     {
  788.         switch($pos{
  789.             case 0:
  790.                 $this->setId($value);
  791.                 break;
  792.             case 1:
  793.                 $this->setServerId($value);
  794.                 break;
  795.             case 2:
  796.                 $this->setPort($value);
  797.                 break;
  798.             case 3:
  799.                 $this->setIp($value);
  800.                 break;
  801.             case 4:
  802.                 $this->setMask($value);
  803.                 break;
  804.             case 5:
  805.                 $this->setMac($value);
  806.                 break;
  807.             case 6:
  808.                 $this->setVlan($value);
  809.                 break;
  810.         // switch()
  811.     }
  812.  
  813.     /**
  814.      * Populates the object using an array.
  815.      *
  816.      * This is particularly useful when populating an object from one of the
  817.      * request arrays (e.g. $_POST).  This method goes through the column
  818.      * names, checking to see whether a matching key exists in populated
  819.      * array. If so the setByName() method is called for that column.
  820.      *
  821.      * You can specify the key type of the array by additionally passing one
  822.      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  823.      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  824.      * The default key type is the column's phpname (e.g. 'AuthorId')
  825.      *
  826.      * @param      array  $arr     An array to populate the object from.
  827.      * @param      string $keyType The type of keys the array uses.
  828.      * @return     void 
  829.      */
  830.     public function fromArray($arr$keyType BasePeer::TYPE_PHPNAME)
  831.     {
  832.         $keys EtvaNetworkPeer::getFieldNames($keyType);
  833.  
  834.         if (array_key_exists($keys[0]$arr)) $this->setId($arr[$keys[0]]);
  835.         if (array_key_exists($keys[1]$arr)) $this->setServerId($arr[$keys[1]]);
  836.         if (array_key_exists($keys[2]$arr)) $this->setPort($arr[$keys[2]]);
  837.         if (array_key_exists($keys[3]$arr)) $this->setIp($arr[$keys[3]]);
  838.         if (array_key_exists($keys[4]$arr)) $this->setMask($arr[$keys[4]]);
  839.         if (array_key_exists($keys[5]$arr)) $this->setMac($arr[$keys[5]]);
  840.         if (array_key_exists($keys[6]$arr)) $this->setVlan($arr[$keys[6]]);
  841.     }
  842.  
  843.     /**
  844.      * Build a Criteria object containing the values of all modified columns in this object.
  845.      *
  846.      * @return     Criteria The Criteria object containing all modified values.
  847.      */
  848.     public function buildCriteria()
  849.     {
  850.         $criteria new Criteria(EtvaNetworkPeer::DATABASE_NAME);
  851.  
  852.         if ($this->isColumnModified(EtvaNetworkPeer::ID)) $criteria->add(EtvaNetworkPeer::ID$this->id);
  853.         if ($this->isColumnModified(EtvaNetworkPeer::SERVER_ID)) $criteria->add(EtvaNetworkPeer::SERVER_ID$this->server_id);
  854.         if ($this->isColumnModified(EtvaNetworkPeer::PORT)) $criteria->add(EtvaNetworkPeer::PORT$this->port);
  855.         if ($this->isColumnModified(EtvaNetworkPeer::IP)) $criteria->add(EtvaNetworkPeer::IP$this->ip);
  856.         if ($this->isColumnModified(EtvaNetworkPeer::MASK)) $criteria->add(EtvaNetworkPeer::MASK$this->mask);
  857.         if ($this->isColumnModified(EtvaNetworkPeer::MAC)) $criteria->add(EtvaNetworkPeer::MAC$this->mac);
  858.         if ($this->isColumnModified(EtvaNetworkPeer::VLAN)) $criteria->add(EtvaNetworkPeer::VLAN$this->vlan);
  859.  
  860.         return $criteria;
  861.     }
  862.  
  863.     /**
  864.      * Builds a Criteria object containing the primary key for this object.
  865.      *
  866.      * Unlike buildCriteria() this method includes the primary key values regardless
  867.      * of whether or not they have been modified.
  868.      *
  869.      * @return     Criteria The Criteria object containing value(s) for primary key(s).
  870.      */
  871.     public function buildPkeyCriteria()
  872.     {
  873.         $criteria new Criteria(EtvaNetworkPeer::DATABASE_NAME);
  874.  
  875.         $criteria->add(EtvaNetworkPeer::ID$this->id);
  876.  
  877.         return $criteria;
  878.     }
  879.  
  880.     /**
  881.      * Returns the primary key for this object (row).
  882.      * @return     int 
  883.      */
  884.     public function getPrimaryKey()
  885.     {
  886.         return $this->getId();
  887.     }
  888.  
  889.     /**
  890.      * Generic method to set the primary key (id column).
  891.      *
  892.      * @param      int $key Primary key.
  893.      * @return     void 
  894.      */
  895.     public function setPrimaryKey($key)
  896.     {
  897.         $this->setId($key);
  898.     }
  899.  
  900.     /**
  901.      * Sets contents of passed object to values from current object.
  902.      *
  903.      * If desired, this method can also make copies of all associated (fkey referrers)
  904.      * objects.
  905.      *
  906.      * @param      object $copyObj An object of EtvaNetwork (or compatible) type.
  907.      * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  908.      * @throws     PropelException
  909.      */
  910.     public function copyInto($copyObj$deepCopy false)
  911.     {
  912.  
  913.         $copyObj->setServerId($this->server_id);
  914.  
  915.         $copyObj->setPort($this->port);
  916.  
  917.         $copyObj->setIp($this->ip);
  918.  
  919.         $copyObj->setMask($this->mask);
  920.  
  921.         $copyObj->setMac($this->mac);
  922.  
  923.         $copyObj->setVlan($this->vlan);
  924.  
  925.  
  926.         $copyObj->setNew(true);
  927.  
  928.         $copyObj->setId(NULL)// this is a auto-increment column, so set to default value
  929.  
  930.     }
  931.  
  932.     /**
  933.      * Makes a copy of this object that will be inserted as a new row in table when saved.
  934.      * It creates a new object filling in the simple attributes, but skipping any primary
  935.      * keys that are defined for the table.
  936.      *
  937.      * If desired, this method can also make copies of all associated (fkey referrers)
  938.      * objects.
  939.      *
  940.      * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  941.      * @return     EtvaNetwork Clone of current object.
  942.      * @throws     PropelException
  943.      */
  944.     public function copy($deepCopy false)
  945.     {
  946.         // we use get_class(), because this might be a subclass
  947.         $clazz get_class($this);
  948.         $copyObj new $clazz();
  949.         $this->copyInto($copyObj$deepCopy);
  950.         return $copyObj;
  951.     }
  952.  
  953.     /**
  954.      * Returns a peer instance associated with this om.
  955.      *
  956.      * Since Peer classes are not to have any instance attributes, this method returns the
  957.      * same instance for all member of this class. The method could therefore
  958.      * be static, but this would prevent one from overriding the behavior.
  959.      *
  960.      * @return     EtvaNetworkPeer 
  961.      */
  962.     public function getPeer()
  963.     {
  964.         if (self::$peer === null{
  965.             self::$peer new EtvaNetworkPeer();
  966.         }
  967.         return self::$peer;
  968.     }
  969.  
  970.     /**
  971.      * Declares an association between this object and a EtvaServer object.
  972.      *
  973.      * @param      EtvaServer $v 
  974.      * @return     EtvaNetwork The current object (for fluent API support)
  975.      * @throws     PropelException
  976.      */
  977.     public function setEtvaServer(EtvaServer $v null)
  978.     {
  979.         if ($v === null{
  980.             $this->setServerId(NULL);
  981.         else {
  982.             $this->setServerId($v->getId());
  983.         }
  984.  
  985.         $this->aEtvaServer = $v;
  986.  
  987.         // Add binding for other direction of this n:n relationship.
  988.         // If this object has already been added to the EtvaServer object, it will not be re-added.
  989.         if ($v !== null{
  990.             $v->addEtvaNetwork($this);
  991.         }
  992.  
  993.         return $this;
  994.     }
  995.  
  996.  
  997.     /**
  998.      * Get the associated EtvaServer object
  999.      *
  1000.      * @param      PropelPDO Optional Connection object.
  1001.      * @return     EtvaServer The associated EtvaServer object.
  1002.      * @throws     PropelException
  1003.      */
  1004.     public function getEtvaServer(PropelPDO $con null)
  1005.     {
  1006.         if ($this->aEtvaServer === null && ($this->server_id !== null)) {
  1007.             $c new Criteria(EtvaServerPeer::DATABASE_NAME);
  1008.             $c->add(EtvaServerPeer::ID$this->server_id);
  1009.             $this->aEtvaServer = EtvaServerPeer::doSelectOne($c$con);
  1010.             /* The following can be used additionally to
  1011.                guarantee the related object contains a reference
  1012.                to this object.  This level of coupling may, however, be
  1013.                undesirable since it could result in an only partially populated collection
  1014.                in the referenced object.
  1015.                $this->aEtvaServer->addEtvaNetworks($this);
  1016.              */
  1017.         }
  1018.         return $this->aEtvaServer;
  1019.     }
  1020.  
  1021.     /**
  1022.      * Resets all collections of referencing foreign keys.
  1023.      *
  1024.      * This method is a user-space workaround for PHP's inability to garbage collect objects
  1025.      * with circular references.  This is currently necessary when using Propel in certain
  1026.      * daemon or large-volumne/high-memory operations.
  1027.      *
  1028.      * @param      boolean $deep Whether to also clear the references on all associated objects.
  1029.      */
  1030.     public function clearAllReferences($deep false)
  1031.     {
  1032.         if ($deep{
  1033.         // if ($deep)
  1034.  
  1035.             $this->aEtvaServer = null;
  1036.     }
  1037.  
  1038.  
  1039.   public function __call($method$arguments)
  1040.   {
  1041.     if (!$callable sfMixer::getCallable('BaseEtvaNetwork:'.$method))
  1042.     {
  1043.       throw new sfException(sprintf('Call to undefined method BaseEtvaNetwork::%s'$method));
  1044.     }
  1045.  
  1046.     array_unshift($arguments$this);
  1047.  
  1048.     return call_user_func_array($callable$arguments);
  1049.   }
  1050.  
  1051.  
  1052. // BaseEtvaNetwork

Documentation generated on Fri, 19 Jun 2009 10:46:52 +0100 by phpDocumentor 1.4.2