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

Source for file BaseEtvaLogicalvolume.php

Documentation is available at BaseEtvaLogicalvolume.php

  1. <?php
  2.  
  3. /**
  4.  * Base class that represents a row from the 'logicalvolume' 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 BaseEtvaLogicalvolume extends BaseObject  implements Persistent {
  15.  
  16.  
  17.   const PEER = 'EtvaLogicalvolumePeer';
  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        EtvaLogicalvolumePeer 
  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 volumegroup_id field.
  35.      * @var        int 
  36.      */
  37.     protected $volumegroup_id;
  38.  
  39.     /**
  40.      * The value for the node_id field.
  41.      * @var        int 
  42.      */
  43.     protected $node_id;
  44.  
  45.     /**
  46.      * The value for the lv field.
  47.      * @var        string 
  48.      */
  49.     protected $lv;
  50.  
  51.     /**
  52.      * The value for the lvdevice field.
  53.      * @var        string 
  54.      */
  55.     protected $lvdevice;
  56.  
  57.     /**
  58.      * The value for the size field.
  59.      * @var        string 
  60.      */
  61.     protected $size;
  62.  
  63.     /**
  64.      * The value for the freesize field.
  65.      * @var        string 
  66.      */
  67.     protected $freesize;
  68.  
  69.     /**
  70.      * The value for the storage_type field.
  71.      * @var        string 
  72.      */
  73.     protected $storage_type;
  74.  
  75.     /**
  76.      * The value for the writeable field.
  77.      * @var        int 
  78.      */
  79.     protected $writeable;
  80.  
  81.     /**
  82.      * The value for the in_use field.
  83.      * Note: this column has a database default value of: 0
  84.      * @var        int 
  85.      */
  86.     protected $in_use;
  87.  
  88.     /**
  89.      * @var        EtvaVolumegroup 
  90.      */
  91.     protected $aEtvaVolumegroup;
  92.  
  93.     /**
  94.      * @var        EtvaNode 
  95.      */
  96.     protected $aEtvaNode;
  97.  
  98.     /**
  99.      * @var        array EtvaServer[] Collection to store aggregation of EtvaServer objects.
  100.      */
  101.     protected $collEtvaServers;
  102.  
  103.     /**
  104.      * @var        Criteria The criteria used to select the current contents of collEtvaServers.
  105.      */
  106.     private $lastEtvaServerCriteria null;
  107.  
  108.     /**
  109.      * Flag to prevent endless save loop, if this object is referenced
  110.      * by another object which falls in this transaction.
  111.      * @var        boolean 
  112.      */
  113.     protected $alreadyInSave = false;
  114.  
  115.     /**
  116.      * Flag to prevent endless validation loop, if this object is referenced
  117.      * by another object which falls in this transaction.
  118.      * @var        boolean 
  119.      */
  120.     protected $alreadyInValidation = false;
  121.  
  122.     /**
  123.      * Initializes internal state of BaseEtvaLogicalvolume object.
  124.      * @see        applyDefaults()
  125.      */
  126.     public function __construct()
  127.     {
  128.         parent::__construct();
  129.         $this->applyDefaultValues();
  130.     }
  131.  
  132.     /**
  133.      * Applies default values to this object.
  134.      * This method should be called from the object's constructor (or
  135.      * equivalent initialization method).
  136.      * @see        __construct()
  137.      */
  138.     public function applyDefaultValues()
  139.     {
  140.         $this->in_use = 0;
  141.     }
  142.  
  143.     /**
  144.      * Get the [id] column value.
  145.      * 
  146.      * @return     int 
  147.      */
  148.     public function getId()
  149.     {
  150.         return $this->id;
  151.     }
  152.  
  153.     /**
  154.      * Get the [volumegroup_id] column value.
  155.      * 
  156.      * @return     int 
  157.      */
  158.     public function getVolumegroupId()
  159.     {
  160.         return $this->volumegroup_id;
  161.     }
  162.  
  163.     /**
  164.      * Get the [node_id] column value.
  165.      * 
  166.      * @return     int 
  167.      */
  168.     public function getNodeId()
  169.     {
  170.         return $this->node_id;
  171.     }
  172.  
  173.     /**
  174.      * Get the [lv] column value.
  175.      * 
  176.      * @return     string 
  177.      */
  178.     public function getLv()
  179.     {
  180.         return $this->lv;
  181.     }
  182.  
  183.     /**
  184.      * Get the [lvdevice] column value.
  185.      * 
  186.      * @return     string 
  187.      */
  188.     public function getLvdevice()
  189.     {
  190.         return $this->lvdevice;
  191.     }
  192.  
  193.     /**
  194.      * Get the [size] column value.
  195.      * 
  196.      * @return     string 
  197.      */
  198.     public function getSize()
  199.     {
  200.         return $this->size;
  201.     }
  202.  
  203.     /**
  204.      * Get the [freesize] column value.
  205.      * 
  206.      * @return     string 
  207.      */
  208.     public function getFreesize()
  209.     {
  210.         return $this->freesize;
  211.     }
  212.  
  213.     /**
  214.      * Get the [storage_type] column value.
  215.      * 
  216.      * @return     string 
  217.      */
  218.     public function getStorageType()
  219.     {
  220.         return $this->storage_type;
  221.     }
  222.  
  223.     /**
  224.      * Get the [writeable] column value.
  225.      * 
  226.      * @return     int 
  227.      */
  228.     public function getWriteable()
  229.     {
  230.         return $this->writeable;
  231.     }
  232.  
  233.     /**
  234.      * Get the [in_use] column value.
  235.      * 
  236.      * @return     int 
  237.      */
  238.     public function getInUse()
  239.     {
  240.         return $this->in_use;
  241.     }
  242.  
  243.     /**
  244.      * Set the value of [id] column.
  245.      * 
  246.      * @param      int $v new value
  247.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  248.      */
  249.     public function setId($v)
  250.     {
  251.         if ($v !== null{
  252.             $v = (int) $v;
  253.         }
  254.  
  255.         if ($this->id !== $v{
  256.             $this->id = $v;
  257.             $this->modifiedColumns[EtvaLogicalvolumePeer::ID;
  258.         }
  259.  
  260.         return $this;
  261.     // setId()
  262.  
  263.     /**
  264.      * Set the value of [volumegroup_id] column.
  265.      * 
  266.      * @param      int $v new value
  267.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  268.      */
  269.     public function setVolumegroupId($v)
  270.     {
  271.         if ($v !== null{
  272.             $v = (int) $v;
  273.         }
  274.  
  275.         if ($this->volumegroup_id !== $v{
  276.             $this->volumegroup_id = $v;
  277.             $this->modifiedColumns[EtvaLogicalvolumePeer::VOLUMEGROUP_ID;
  278.         }
  279.  
  280.         if ($this->aEtvaVolumegroup !== null && $this->aEtvaVolumegroup->getId(!== $v{
  281.             $this->aEtvaVolumegroup = null;
  282.         }
  283.  
  284.         return $this;
  285.     // setVolumegroupId()
  286.  
  287.     /**
  288.      * Set the value of [node_id] column.
  289.      * 
  290.      * @param      int $v new value
  291.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  292.      */
  293.     public function setNodeId($v)
  294.     {
  295.         if ($v !== null{
  296.             $v = (int) $v;
  297.         }
  298.  
  299.         if ($this->node_id !== $v{
  300.             $this->node_id = $v;
  301.             $this->modifiedColumns[EtvaLogicalvolumePeer::NODE_ID;
  302.         }
  303.  
  304.         if ($this->aEtvaNode !== null && $this->aEtvaNode->getId(!== $v{
  305.             $this->aEtvaNode = null;
  306.         }
  307.  
  308.         return $this;
  309.     // setNodeId()
  310.  
  311.     /**
  312.      * Set the value of [lv] column.
  313.      * 
  314.      * @param      string $v new value
  315.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  316.      */
  317.     public function setLv($v)
  318.     {
  319.         if ($v !== null{
  320.             $v = (string) $v;
  321.         }
  322.  
  323.         if ($this->lv !== $v{
  324.             $this->lv = $v;
  325.             $this->modifiedColumns[EtvaLogicalvolumePeer::LV;
  326.         }
  327.  
  328.         return $this;
  329.     // setLv()
  330.  
  331.     /**
  332.      * Set the value of [lvdevice] column.
  333.      * 
  334.      * @param      string $v new value
  335.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  336.      */
  337.     public function setLvdevice($v)
  338.     {
  339.         if ($v !== null{
  340.             $v = (string) $v;
  341.         }
  342.  
  343.         if ($this->lvdevice !== $v{
  344.             $this->lvdevice = $v;
  345.             $this->modifiedColumns[EtvaLogicalvolumePeer::LVDEVICE;
  346.         }
  347.  
  348.         return $this;
  349.     // setLvdevice()
  350.  
  351.     /**
  352.      * Set the value of [size] column.
  353.      * 
  354.      * @param      string $v new value
  355.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  356.      */
  357.     public function setSize($v)
  358.     {
  359.         if ($v !== null{
  360.             $v = (string) $v;
  361.         }
  362.  
  363.         if ($this->size !== $v{
  364.             $this->size = $v;
  365.             $this->modifiedColumns[EtvaLogicalvolumePeer::SIZE;
  366.         }
  367.  
  368.         return $this;
  369.     // setSize()
  370.  
  371.     /**
  372.      * Set the value of [freesize] column.
  373.      * 
  374.      * @param      string $v new value
  375.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  376.      */
  377.     public function setFreesize($v)
  378.     {
  379.         if ($v !== null{
  380.             $v = (string) $v;
  381.         }
  382.  
  383.         if ($this->freesize !== $v{
  384.             $this->freesize = $v;
  385.             $this->modifiedColumns[EtvaLogicalvolumePeer::FREESIZE;
  386.         }
  387.  
  388.         return $this;
  389.     // setFreesize()
  390.  
  391.     /**
  392.      * Set the value of [storage_type] column.
  393.      * 
  394.      * @param      string $v new value
  395.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  396.      */
  397.     public function setStorageType($v)
  398.     {
  399.         if ($v !== null{
  400.             $v = (string) $v;
  401.         }
  402.  
  403.         if ($this->storage_type !== $v{
  404.             $this->storage_type = $v;
  405.             $this->modifiedColumns[EtvaLogicalvolumePeer::STORAGE_TYPE;
  406.         }
  407.  
  408.         return $this;
  409.     // setStorageType()
  410.  
  411.     /**
  412.      * Set the value of [writeable] column.
  413.      * 
  414.      * @param      int $v new value
  415.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  416.      */
  417.     public function setWriteable($v)
  418.     {
  419.         if ($v !== null{
  420.             $v = (int) $v;
  421.         }
  422.  
  423.         if ($this->writeable !== $v{
  424.             $this->writeable = $v;
  425.             $this->modifiedColumns[EtvaLogicalvolumePeer::WRITEABLE;
  426.         }
  427.  
  428.         return $this;
  429.     // setWriteable()
  430.  
  431.     /**
  432.      * Set the value of [in_use] column.
  433.      * 
  434.      * @param      int $v new value
  435.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  436.      */
  437.     public function setInUse($v)
  438.     {
  439.         if ($v !== null{
  440.             $v = (int) $v;
  441.         }
  442.  
  443.         if ($this->in_use !== $v || $v === 0{
  444.             $this->in_use = $v;
  445.             $this->modifiedColumns[EtvaLogicalvolumePeer::IN_USE;
  446.         }
  447.  
  448.         return $this;
  449.     // setInUse()
  450.  
  451.     /**
  452.      * Indicates whether the columns in this object are only set to default values.
  453.      *
  454.      * This method can be used in conjunction with isModified() to indicate whether an object is both
  455.      * modified _and_ has some values set which are non-default.
  456.      *
  457.      * @return     boolean Whether the columns in this object are only been set with default values.
  458.      */
  459.     public function hasOnlyDefaultValues()
  460.     {
  461.             // First, ensure that we don't have any columns that have been modified which aren't default columns.
  462.             if (array_diff($this->modifiedColumnsarray(EtvaLogicalvolumePeer::IN_USE))) {
  463.                 return false;
  464.             }
  465.  
  466.             if ($this->in_use !== 0{
  467.                 return false;
  468.             }
  469.  
  470.         // otherwise, everything was equal, so return TRUE
  471.         return true;
  472.     // hasOnlyDefaultValues()
  473.  
  474.     /**
  475.      * Hydrates (populates) the object variables with values from the database resultset.
  476.      *
  477.      * An offset (0-based "start column") is specified so that objects can be hydrated
  478.      * with a subset of the columns in the resultset rows.  This is needed, for example,
  479.      * for results of JOIN queries where the resultset row includes columns from two or
  480.      * more tables.
  481.      *
  482.      * @param      array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  483.      * @param      int $startcol 0-based offset column which indicates which restultset column to start with.
  484.      * @param      boolean $rehydrate Whether this object is being re-hydrated from the database.
  485.      * @return     int next starting column
  486.      * @throws     PropelException  - Any caught Exception will be rewrapped as a PropelException.
  487.      */
  488.     public function hydrate($row$startcol 0$rehydrate false)
  489.     {
  490.         try {
  491.  
  492.             $this->id = ($row[$startcol 0!== null? (int) $row[$startcol 0null;
  493.             $this->volumegroup_id = ($row[$startcol 1!== null? (int) $row[$startcol 1null;
  494.             $this->node_id = ($row[$startcol 2!== null? (int) $row[$startcol 2null;
  495.             $this->lv = ($row[$startcol 3!== null? (string) $row[$startcol 3null;
  496.             $this->lvdevice = ($row[$startcol 4!== null? (string) $row[$startcol 4null;
  497.             $this->size = ($row[$startcol 5!== null? (string) $row[$startcol 5null;
  498.             $this->freesize = ($row[$startcol 6!== null? (string) $row[$startcol 6null;
  499.             $this->storage_type = ($row[$startcol 7!== null? (string) $row[$startcol 7null;
  500.             $this->writeable = ($row[$startcol 8!== null? (int) $row[$startcol 8null;
  501.             $this->in_use = ($row[$startcol 9!== null? (int) $row[$startcol 9null;
  502.             $this->resetModified();
  503.  
  504.             $this->setNew(false);
  505.  
  506.             if ($rehydrate{
  507.                 $this->ensureConsistency();
  508.             }
  509.  
  510.             // FIXME - using NUM_COLUMNS may be clearer.
  511.             return $startcol 10// 10 = EtvaLogicalvolumePeer::NUM_COLUMNS - EtvaLogicalvolumePeer::NUM_LAZY_LOAD_COLUMNS).
  512.  
  513.         catch (Exception $e{
  514.             throw new PropelException("Error populating EtvaLogicalvolume object"$e);
  515.         }
  516.     }
  517.  
  518.     /**
  519.      * Checks and repairs the internal consistency of the object.
  520.      *
  521.      * This method is executed after an already-instantiated object is re-hydrated
  522.      * from the database.  It exists to check any foreign keys to make sure that
  523.      * the objects related to the current object are correct based on foreign key.
  524.      *
  525.      * You can override this method in the stub class, but you should always invoke
  526.      * the base method from the overridden method (i.e. parent::ensureConsistency()),
  527.      * in case your model changes.
  528.      *
  529.      * @throws     PropelException
  530.      */
  531.     public function ensureConsistency()
  532.     {
  533.  
  534.         if ($this->aEtvaVolumegroup !== null && $this->volumegroup_id !== $this->aEtvaVolumegroup->getId()) {
  535.             $this->aEtvaVolumegroup = null;
  536.         }
  537.         if ($this->aEtvaNode !== null && $this->node_id !== $this->aEtvaNode->getId()) {
  538.             $this->aEtvaNode = null;
  539.         }
  540.     // ensureConsistency
  541.  
  542.     /**
  543.      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  544.      *
  545.      * This will only work if the object has been saved and has a valid primary key set.
  546.      *
  547.      * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  548.      * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  549.      * @return     void 
  550.      * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  551.      */
  552.     public function reload($deep falsePropelPDO $con null)
  553.     {
  554.         if ($this->isDeleted()) {
  555.             throw new PropelException("Cannot reload a deleted object.");
  556.         }
  557.  
  558.         if ($this->isNew()) {
  559.             throw new PropelException("Cannot reload an unsaved object.");
  560.         }
  561.  
  562.         if ($con === null{
  563.             $con Propel::getConnection(EtvaLogicalvolumePeer::DATABASE_NAMEPropel::CONNECTION_READ);
  564.         }
  565.  
  566.         // We don't need to alter the object instance pool; we're just modifying this instance
  567.         // already in the pool.
  568.  
  569.         $stmt EtvaLogicalvolumePeer::doSelectStmt($this->buildPkeyCriteria()$con);
  570.         $row $stmt->fetch(PDO::FETCH_NUM);
  571.         $stmt->closeCursor();
  572.         if (!$row{
  573.             throw new PropelException('Cannot find matching row in the database to reload object values.');
  574.         }
  575.         $this->hydrate($row0true)// rehydrate
  576.  
  577.         if ($deep{  // also de-associate any related objects?
  578.  
  579.             $this->aEtvaVolumegroup = null;
  580.             $this->aEtvaNode = null;
  581.             $this->collEtvaServers = null;
  582.             $this->lastEtvaServerCriteria null;
  583.  
  584.         // if (deep)
  585.     }
  586.  
  587.     /**
  588.      * Removes this object from datastore and sets delete attribute.
  589.      *
  590.      * @param      PropelPDO $con 
  591.      * @return     void 
  592.      * @throws     PropelException
  593.      * @see        BaseObject::setDeleted()
  594.      * @see        BaseObject::isDeleted()
  595.      */
  596.     public function delete(PropelPDO $con null)
  597.     {
  598.  
  599.     foreach (sfMixer::getCallables('BaseEtvaLogicalvolume:delete:pre'as $callable)
  600.     {
  601.       $ret call_user_func($callable$this$con);
  602.       if ($ret)
  603.       {
  604.         return;
  605.       }
  606.     }
  607.  
  608.  
  609.         if ($this->isDeleted()) {
  610.             throw new PropelException("This object has already been deleted.");
  611.         }
  612.  
  613.         if ($con === null{
  614.             $con Propel::getConnection(EtvaLogicalvolumePeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  615.         }
  616.         
  617.         $con->beginTransaction();
  618.         try {
  619.             EtvaLogicalvolumePeer::doDelete($this$con);
  620.             $this->setDeleted(true);
  621.             $con->commit();
  622.         catch (PropelException $e{
  623.             $con->rollBack();
  624.             throw $e;
  625.         }
  626.     
  627.  
  628.     foreach (sfMixer::getCallables('BaseEtvaLogicalvolume:delete:post'as $callable)
  629.     {
  630.       call_user_func($callable$this$con);
  631.     }
  632.  
  633.   }
  634.     /**
  635.      * Persists this object to the database.
  636.      *
  637.      * If the object is new, it inserts it; otherwise an update is performed.
  638.      * All modified related objects will also be persisted in the doSave()
  639.      * method.  This method wraps all precipitate database operations in a
  640.      * single transaction.
  641.      *
  642.      * @param      PropelPDO $con 
  643.      * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  644.      * @throws     PropelException
  645.      * @see        doSave()
  646.      */
  647.     public function save(PropelPDO $con null)
  648.     {
  649.  
  650.     foreach (sfMixer::getCallables('BaseEtvaLogicalvolume:save:pre'as $callable)
  651.     {
  652.       $affectedRows call_user_func($callable$this$con);
  653.       if (is_int($affectedRows))
  654.       {
  655.         return $affectedRows;
  656.       }
  657.     }
  658.  
  659.  
  660.         if ($this->isDeleted()) {
  661.             throw new PropelException("You cannot save an object that has been deleted.");
  662.         }
  663.  
  664.         if ($con === null{
  665.             $con Propel::getConnection(EtvaLogicalvolumePeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  666.         }
  667.         
  668.         $con->beginTransaction();
  669.         try {
  670.             $affectedRows $this->doSave($con);
  671.             $con->commit();
  672.     foreach (sfMixer::getCallables('BaseEtvaLogicalvolume:save:post'as $callable)
  673.     {
  674.       call_user_func($callable$this$con$affectedRows);
  675.     }
  676.  
  677.             EtvaLogicalvolumePeer::addInstanceToPool($this);
  678.             return $affectedRows;
  679.         catch (PropelException $e{
  680.             $con->rollBack();
  681.             throw $e;
  682.         }
  683.     }
  684.  
  685.     /**
  686.      * Performs the work of inserting or updating the row in the database.
  687.      *
  688.      * If the object is new, it inserts it; otherwise an update is performed.
  689.      * All related objects are also updated in this method.
  690.      *
  691.      * @param      PropelPDO $con 
  692.      * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  693.      * @throws     PropelException
  694.      * @see        save()
  695.      */
  696.     protected function doSave(PropelPDO $con)
  697.     {
  698.         $affectedRows 0// initialize var to track total num of affected rows
  699.         if (!$this->alreadyInSave{
  700.             $this->alreadyInSave = true;
  701.  
  702.             // We call the save method on the following object(s) if they
  703.             // were passed to this object by their coresponding set
  704.             // method.  This object relates to these object(s) by a
  705.             // foreign key reference.
  706.  
  707.             if ($this->aEtvaVolumegroup !== null{
  708.                 if ($this->aEtvaVolumegroup->isModified(|| $this->aEtvaVolumegroup->isNew()) {
  709.                     $affectedRows += $this->aEtvaVolumegroup->save($con);
  710.                 }
  711.                 $this->setEtvaVolumegroup($this->aEtvaVolumegroup);
  712.             }
  713.  
  714.             if ($this->aEtvaNode !== null{
  715.                 if ($this->aEtvaNode->isModified(|| $this->aEtvaNode->isNew()) {
  716.                     $affectedRows += $this->aEtvaNode->save($con);
  717.                 }
  718.                 $this->setEtvaNode($this->aEtvaNode);
  719.             }
  720.  
  721.             if ($this->isNew() ) {
  722.                 $this->modifiedColumns[EtvaLogicalvolumePeer::ID;
  723.             }
  724.  
  725.             // If this object has been modified, then save it to the database.
  726.             if ($this->isModified()) {
  727.                 if ($this->isNew()) {
  728.                     $pk EtvaLogicalvolumePeer::doInsert($this$con);
  729.                     $affectedRows += 1// we are assuming that there is only 1 row per doInsert() which
  730.                                          // should always be true here (even though technically
  731.                                          // BasePeer::doInsert() can insert multiple rows).
  732.  
  733.                     $this->setId($pk);  //[IMV] update autoincrement primary key
  734.  
  735.                     $this->setNew(false);
  736.                 else {
  737.                     $affectedRows += EtvaLogicalvolumePeer::doUpdate($this$con);
  738.                 }
  739.  
  740.                 $this->resetModified()// [HL] After being saved an object is no longer 'modified'
  741.             }
  742.  
  743.             if ($this->collEtvaServers !== null{
  744.                 foreach ($this->collEtvaServers as $referrerFK{
  745.                     if (!$referrerFK->isDeleted()) {
  746.                         $affectedRows += $referrerFK->save($con);
  747.                     }
  748.                 }
  749.             }
  750.  
  751.             $this->alreadyInSave = false;
  752.  
  753.         }
  754.         return $affectedRows;
  755.     // doSave()
  756.  
  757.     /**
  758.      * Array of ValidationFailed objects.
  759.      * @var        array ValidationFailed[]
  760.      */
  761.     protected $validationFailures = array();
  762.  
  763.     /**
  764.      * Gets any ValidationFailed objects that resulted from last call to validate().
  765.      *
  766.      *
  767.      * @return     array ValidationFailed[]
  768.      * @see        validate()
  769.      */
  770.     public function getValidationFailures()
  771.     {
  772.         return $this->validationFailures;
  773.     }
  774.  
  775.     /**
  776.      * Validates the objects modified field values and all objects related to this table.
  777.      *
  778.      * If $columns is either a column name or an array of column names
  779.      * only those columns are validated.
  780.      *
  781.      * @param      mixed $columns Column name or an array of column names.
  782.      * @return     boolean Whether all columns pass validation.
  783.      * @see        doValidate()
  784.      * @see        getValidationFailures()
  785.      */
  786.     public function validate($columns null)
  787.     {
  788.         $res $this->doValidate($columns);
  789.         if ($res === true{
  790.             $this->validationFailures = array();
  791.             return true;
  792.         else {
  793.             $this->validationFailures = $res;
  794.             return false;
  795.         }
  796.     }
  797.  
  798.     /**
  799.      * This function performs the validation work for complex object models.
  800.      *
  801.      * In addition to checking the current object, all related objects will
  802.      * also be validated.  If all pass then <code>true</code> is returned; otherwise
  803.      * an aggreagated array of ValidationFailed objects will be returned.
  804.      *
  805.      * @param      array $columns Array of column names to validate.
  806.      * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  807.      */
  808.     protected function doValidate($columns null)
  809.     {
  810.         if (!$this->alreadyInValidation{
  811.             $this->alreadyInValidation = true;
  812.             $retval null;
  813.  
  814.             $failureMap array();
  815.  
  816.  
  817.             // We call the validate method on the following object(s) if they
  818.             // were passed to this object by their coresponding set
  819.             // method.  This object relates to these object(s) by a
  820.             // foreign key reference.
  821.  
  822.             if ($this->aEtvaVolumegroup !== null{
  823.                 if (!$this->aEtvaVolumegroup->validate($columns)) {
  824.                     $failureMap array_merge($failureMap$this->aEtvaVolumegroup->getValidationFailures());
  825.                 }
  826.             }
  827.  
  828.             if ($this->aEtvaNode !== null{
  829.                 if (!$this->aEtvaNode->validate($columns)) {
  830.                     $failureMap array_merge($failureMap$this->aEtvaNode->getValidationFailures());
  831.                 }
  832.             }
  833.  
  834.  
  835.             if (($retval EtvaLogicalvolumePeer::doValidate($this$columns)) !== true{
  836.                 $failureMap array_merge($failureMap$retval);
  837.             }
  838.  
  839.  
  840.                 if ($this->collEtvaServers !== null{
  841.                     foreach ($this->collEtvaServers as $referrerFK{
  842.                         if (!$referrerFK->validate($columns)) {
  843.                             $failureMap array_merge($failureMap$referrerFK->getValidationFailures());
  844.                         }
  845.                     }
  846.                 }
  847.  
  848.  
  849.             $this->alreadyInValidation = false;
  850.         }
  851.  
  852.         return (!empty($failureMap$failureMap true);
  853.     }
  854.  
  855.     /**
  856.      * Retrieves a field from the object by name passed in as a string.
  857.      *
  858.      * @param      string $name name
  859.      * @param      string $type The type of fieldname the $name is of:
  860.      *                      one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  861.      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  862.      * @return     mixed Value of field.
  863.      */
  864.     public function getByName($name$type BasePeer::TYPE_PHPNAME)
  865.     {
  866.         $pos EtvaLogicalvolumePeer::translateFieldName($name$typeBasePeer::TYPE_NUM);
  867.         $field $this->getByPosition($pos);
  868.         return $field;
  869.     }
  870.  
  871.     /**
  872.      * Retrieves a field from the object by Position as specified in the xml schema.
  873.      * Zero-based.
  874.      *
  875.      * @param      int $pos position in xml schema
  876.      * @return     mixed Value of field at $pos
  877.      */
  878.     public function getByPosition($pos)
  879.     {
  880.         switch($pos{
  881.             case 0:
  882.                 return $this->getId();
  883.                 break;
  884.             case 1:
  885.                 return $this->getVolumegroupId();
  886.                 break;
  887.             case 2:
  888.                 return $this->getNodeId();
  889.                 break;
  890.             case 3:
  891.                 return $this->getLv();
  892.                 break;
  893.             case 4:
  894.                 return $this->getLvdevice();
  895.                 break;
  896.             case 5:
  897.                 return $this->getSize();
  898.                 break;
  899.             case 6:
  900.                 return $this->getFreesize();
  901.                 break;
  902.             case 7:
  903.                 return $this->getStorageType();
  904.                 break;
  905.             case 8:
  906.                 return $this->getWriteable();
  907.                 break;
  908.             case 9:
  909.                 return $this->getInUse();
  910.                 break;
  911.             default:
  912.                 return null;
  913.                 break;
  914.         // switch()
  915.     }
  916.  
  917.     /**
  918.      * Exports the object as an array.
  919.      *
  920.      * You can specify the key type of the array by passing one of the class
  921.      * type constants.
  922.      *
  923.      * @param      string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  924.      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
  925.      * @param      boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns.  Defaults to TRUE.
  926.      * @return     an associative array containing the field names (as keys) and field values
  927.      */
  928.     public function toArray($keyType BasePeer::TYPE_PHPNAME$includeLazyLoadColumns true)
  929.     {
  930.         $keys EtvaLogicalvolumePeer::getFieldNames($keyType);
  931.         $result array(
  932.             $keys[0=> $this->getId(),
  933.             $keys[1=> $this->getVolumegroupId(),
  934.             $keys[2=> $this->getNodeId(),
  935.             $keys[3=> $this->getLv(),
  936.             $keys[4=> $this->getLvdevice(),
  937.             $keys[5=> $this->getSize(),
  938.             $keys[6=> $this->getFreesize(),
  939.             $keys[7=> $this->getStorageType(),
  940.             $keys[8=> $this->getWriteable(),
  941.             $keys[9=> $this->getInUse(),
  942.         );
  943.         return $result;
  944.     }
  945.  
  946.     /**
  947.      * Sets a field from the object by name passed in as a string.
  948.      *
  949.      * @param      string $name peer name
  950.      * @param      mixed $value field value
  951.      * @param      string $type The type of fieldname the $name is of:
  952.      *                      one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  953.      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  954.      * @return     void 
  955.      */
  956.     public function setByName($name$value$type BasePeer::TYPE_PHPNAME)
  957.     {
  958.         $pos EtvaLogicalvolumePeer::translateFieldName($name$typeBasePeer::TYPE_NUM);
  959.         return $this->setByPosition($pos$value);
  960.     }
  961.  
  962.     /**
  963.      * Sets a field from the object by Position as specified in the xml schema.
  964.      * Zero-based.
  965.      *
  966.      * @param      int $pos position in xml schema
  967.      * @param      mixed $value field value
  968.      * @return     void 
  969.      */
  970.     public function setByPosition($pos$value)
  971.     {
  972.         switch($pos{
  973.             case 0:
  974.                 $this->setId($value);
  975.                 break;
  976.             case 1:
  977.                 $this->setVolumegroupId($value);
  978.                 break;
  979.             case 2:
  980.                 $this->setNodeId($value);
  981.                 break;
  982.             case 3:
  983.                 $this->setLv($value);
  984.                 break;
  985.             case 4:
  986.                 $this->setLvdevice($value);
  987.                 break;
  988.             case 5:
  989.                 $this->setSize($value);
  990.                 break;
  991.             case 6:
  992.                 $this->setFreesize($value);
  993.                 break;
  994.             case 7:
  995.                 $this->setStorageType($value);
  996.                 break;
  997.             case 8:
  998.                 $this->setWriteable($value);
  999.                 break;
  1000.             case 9:
  1001.                 $this->setInUse($value);
  1002.                 break;
  1003.         // switch()
  1004.     }
  1005.  
  1006.     /**
  1007.      * Populates the object using an array.
  1008.      *
  1009.      * This is particularly useful when populating an object from one of the
  1010.      * request arrays (e.g. $_POST).  This method goes through the column
  1011.      * names, checking to see whether a matching key exists in populated
  1012.      * array. If so the setByName() method is called for that column.
  1013.      *
  1014.      * You can specify the key type of the array by additionally passing one
  1015.      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  1016.      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  1017.      * The default key type is the column's phpname (e.g. 'AuthorId')
  1018.      *
  1019.      * @param      array  $arr     An array to populate the object from.
  1020.      * @param      string $keyType The type of keys the array uses.
  1021.      * @return     void 
  1022.      */
  1023.     public function fromArray($arr$keyType BasePeer::TYPE_PHPNAME)
  1024.     {
  1025.         $keys EtvaLogicalvolumePeer::getFieldNames($keyType);
  1026.  
  1027.         if (array_key_exists($keys[0]$arr)) $this->setId($arr[$keys[0]]);
  1028.         if (array_key_exists($keys[1]$arr)) $this->setVolumegroupId($arr[$keys[1]]);
  1029.         if (array_key_exists($keys[2]$arr)) $this->setNodeId($arr[$keys[2]]);
  1030.         if (array_key_exists($keys[3]$arr)) $this->setLv($arr[$keys[3]]);
  1031.         if (array_key_exists($keys[4]$arr)) $this->setLvdevice($arr[$keys[4]]);
  1032.         if (array_key_exists($keys[5]$arr)) $this->setSize($arr[$keys[5]]);
  1033.         if (array_key_exists($keys[6]$arr)) $this->setFreesize($arr[$keys[6]]);
  1034.         if (array_key_exists($keys[7]$arr)) $this->setStorageType($arr[$keys[7]]);
  1035.         if (array_key_exists($keys[8]$arr)) $this->setWriteable($arr[$keys[8]]);
  1036.         if (array_key_exists($keys[9]$arr)) $this->setInUse($arr[$keys[9]]);
  1037.     }
  1038.  
  1039.     /**
  1040.      * Build a Criteria object containing the values of all modified columns in this object.
  1041.      *
  1042.      * @return     Criteria The Criteria object containing all modified values.
  1043.      */
  1044.     public function buildCriteria()
  1045.     {
  1046.         $criteria new Criteria(EtvaLogicalvolumePeer::DATABASE_NAME);
  1047.  
  1048.         if ($this->isColumnModified(EtvaLogicalvolumePeer::ID)) $criteria->add(EtvaLogicalvolumePeer::ID$this->id);
  1049.         if ($this->isColumnModified(EtvaLogicalvolumePeer::VOLUMEGROUP_ID)) $criteria->add(EtvaLogicalvolumePeer::VOLUMEGROUP_ID$this->volumegroup_id);
  1050.         if ($this->isColumnModified(EtvaLogicalvolumePeer::NODE_ID)) $criteria->add(EtvaLogicalvolumePeer::NODE_ID$this->node_id);
  1051.         if ($this->isColumnModified(EtvaLogicalvolumePeer::LV)) $criteria->add(EtvaLogicalvolumePeer::LV$this->lv);
  1052.         if ($this->isColumnModified(EtvaLogicalvolumePeer::LVDEVICE)) $criteria->add(EtvaLogicalvolumePeer::LVDEVICE$this->lvdevice);
  1053.         if ($this->isColumnModified(EtvaLogicalvolumePeer::SIZE)) $criteria->add(EtvaLogicalvolumePeer::SIZE$this->size);
  1054.         if ($this->isColumnModified(EtvaLogicalvolumePeer::FREESIZE)) $criteria->add(EtvaLogicalvolumePeer::FREESIZE$this->freesize);
  1055.         if ($this->isColumnModified(EtvaLogicalvolumePeer::STORAGE_TYPE)) $criteria->add(EtvaLogicalvolumePeer::STORAGE_TYPE$this->storage_type);
  1056.         if ($this->isColumnModified(EtvaLogicalvolumePeer::WRITEABLE)) $criteria->add(EtvaLogicalvolumePeer::WRITEABLE$this->writeable);
  1057.         if ($this->isColumnModified(EtvaLogicalvolumePeer::IN_USE)) $criteria->add(EtvaLogicalvolumePeer::IN_USE$this->in_use);
  1058.  
  1059.         return $criteria;
  1060.     }
  1061.  
  1062.     /**
  1063.      * Builds a Criteria object containing the primary key for this object.
  1064.      *
  1065.      * Unlike buildCriteria() this method includes the primary key values regardless
  1066.      * of whether or not they have been modified.
  1067.      *
  1068.      * @return     Criteria The Criteria object containing value(s) for primary key(s).
  1069.      */
  1070.     public function buildPkeyCriteria()
  1071.     {
  1072.         $criteria new Criteria(EtvaLogicalvolumePeer::DATABASE_NAME);
  1073.  
  1074.         $criteria->add(EtvaLogicalvolumePeer::ID$this->id);
  1075.  
  1076.         return $criteria;
  1077.     }
  1078.  
  1079.     /**
  1080.      * Returns the primary key for this object (row).
  1081.      * @return     int 
  1082.      */
  1083.     public function getPrimaryKey()
  1084.     {
  1085.         return $this->getId();
  1086.     }
  1087.  
  1088.     /**
  1089.      * Generic method to set the primary key (id column).
  1090.      *
  1091.      * @param      int $key Primary key.
  1092.      * @return     void 
  1093.      */
  1094.     public function setPrimaryKey($key)
  1095.     {
  1096.         $this->setId($key);
  1097.     }
  1098.  
  1099.     /**
  1100.      * Sets contents of passed object to values from current object.
  1101.      *
  1102.      * If desired, this method can also make copies of all associated (fkey referrers)
  1103.      * objects.
  1104.      *
  1105.      * @param      object $copyObj An object of EtvaLogicalvolume (or compatible) type.
  1106.      * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1107.      * @throws     PropelException
  1108.      */
  1109.     public function copyInto($copyObj$deepCopy false)
  1110.     {
  1111.  
  1112.         $copyObj->setVolumegroupId($this->volumegroup_id);
  1113.  
  1114.         $copyObj->setNodeId($this->node_id);
  1115.  
  1116.         $copyObj->setLv($this->lv);
  1117.  
  1118.         $copyObj->setLvdevice($this->lvdevice);
  1119.  
  1120.         $copyObj->setSize($this->size);
  1121.  
  1122.         $copyObj->setFreesize($this->freesize);
  1123.  
  1124.         $copyObj->setStorageType($this->storage_type);
  1125.  
  1126.         $copyObj->setWriteable($this->writeable);
  1127.  
  1128.         $copyObj->setInUse($this->in_use);
  1129.  
  1130.  
  1131.         if ($deepCopy{
  1132.             // important: temporarily setNew(false) because this affects the behavior of
  1133.             // the getter/setter methods for fkey referrer objects.
  1134.             $copyObj->setNew(false);
  1135.  
  1136.             foreach ($this->getEtvaServers(as $relObj{
  1137.                 if ($relObj !== $this{  // ensure that we don't try to copy a reference to ourselves
  1138.                     $copyObj->addEtvaServer($relObj->copy($deepCopy));
  1139.                 }
  1140.             }
  1141.  
  1142.         // if ($deepCopy)
  1143.  
  1144.  
  1145.         $copyObj->setNew(true);
  1146.  
  1147.         $copyObj->setId(NULL)// this is a auto-increment column, so set to default value
  1148.  
  1149.     }
  1150.  
  1151.     /**
  1152.      * Makes a copy of this object that will be inserted as a new row in table when saved.
  1153.      * It creates a new object filling in the simple attributes, but skipping any primary
  1154.      * keys that are defined for the table.
  1155.      *
  1156.      * If desired, this method can also make copies of all associated (fkey referrers)
  1157.      * objects.
  1158.      *
  1159.      * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1160.      * @return     EtvaLogicalvolume Clone of current object.
  1161.      * @throws     PropelException
  1162.      */
  1163.     public function copy($deepCopy false)
  1164.     {
  1165.         // we use get_class(), because this might be a subclass
  1166.         $clazz get_class($this);
  1167.         $copyObj new $clazz();
  1168.         $this->copyInto($copyObj$deepCopy);
  1169.         return $copyObj;
  1170.     }
  1171.  
  1172.     /**
  1173.      * Returns a peer instance associated with this om.
  1174.      *
  1175.      * Since Peer classes are not to have any instance attributes, this method returns the
  1176.      * same instance for all member of this class. The method could therefore
  1177.      * be static, but this would prevent one from overriding the behavior.
  1178.      *
  1179.      * @return     EtvaLogicalvolumePeer 
  1180.      */
  1181.     public function getPeer()
  1182.     {
  1183.         if (self::$peer === null{
  1184.             self::$peer new EtvaLogicalvolumePeer();
  1185.         }
  1186.         return self::$peer;
  1187.     }
  1188.  
  1189.     /**
  1190.      * Declares an association between this object and a EtvaVolumegroup object.
  1191.      *
  1192.      * @param      EtvaVolumegroup $v 
  1193.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  1194.      * @throws     PropelException
  1195.      */
  1196.     public function setEtvaVolumegroup(EtvaVolumegroup $v null)
  1197.     {
  1198.         if ($v === null{
  1199.             $this->setVolumegroupId(NULL);
  1200.         else {
  1201.             $this->setVolumegroupId($v->getId());
  1202.         }
  1203.  
  1204.         $this->aEtvaVolumegroup = $v;
  1205.  
  1206.         // Add binding for other direction of this n:n relationship.
  1207.         // If this object has already been added to the EtvaVolumegroup object, it will not be re-added.
  1208.         if ($v !== null{
  1209.             $v->addEtvaLogicalvolume($this);
  1210.         }
  1211.  
  1212.         return $this;
  1213.     }
  1214.  
  1215.  
  1216.     /**
  1217.      * Get the associated EtvaVolumegroup object
  1218.      *
  1219.      * @param      PropelPDO Optional Connection object.
  1220.      * @return     EtvaVolumegroup The associated EtvaVolumegroup object.
  1221.      * @throws     PropelException
  1222.      */
  1223.     public function getEtvaVolumegroup(PropelPDO $con null)
  1224.     {
  1225.         if ($this->aEtvaVolumegroup === null && ($this->volumegroup_id !== null)) {
  1226.             $c new Criteria(EtvaVolumegroupPeer::DATABASE_NAME);
  1227.             $c->add(EtvaVolumegroupPeer::ID$this->volumegroup_id);
  1228.             $this->aEtvaVolumegroup = EtvaVolumegroupPeer::doSelectOne($c$con);
  1229.             /* The following can be used additionally to
  1230.                guarantee the related object contains a reference
  1231.                to this object.  This level of coupling may, however, be
  1232.                undesirable since it could result in an only partially populated collection
  1233.                in the referenced object.
  1234.                $this->aEtvaVolumegroup->addEtvaLogicalvolumes($this);
  1235.              */
  1236.         }
  1237.         return $this->aEtvaVolumegroup;
  1238.     }
  1239.  
  1240.     /**
  1241.      * Declares an association between this object and a EtvaNode object.
  1242.      *
  1243.      * @param      EtvaNode $v 
  1244.      * @return     EtvaLogicalvolume The current object (for fluent API support)
  1245.      * @throws     PropelException
  1246.      */
  1247.     public function setEtvaNode(EtvaNode $v null)
  1248.     {
  1249.         if ($v === null{
  1250.             $this->setNodeId(NULL);
  1251.         else {
  1252.             $this->setNodeId($v->getId());
  1253.         }
  1254.  
  1255.         $this->aEtvaNode = $v;
  1256.  
  1257.         // Add binding for other direction of this n:n relationship.
  1258.         // If this object has already been added to the EtvaNode object, it will not be re-added.
  1259.         if ($v !== null{
  1260.             $v->addEtvaLogicalvolume($this);
  1261.         }
  1262.  
  1263.         return $this;
  1264.     }
  1265.  
  1266.  
  1267.     /**
  1268.      * Get the associated EtvaNode object
  1269.      *
  1270.      * @param      PropelPDO Optional Connection object.
  1271.      * @return     EtvaNode The associated EtvaNode object.
  1272.      * @throws     PropelException
  1273.      */
  1274.     public function getEtvaNode(PropelPDO $con null)
  1275.     {
  1276.         if ($this->aEtvaNode === null && ($this->node_id !== null)) {
  1277.             $c new Criteria(EtvaNodePeer::DATABASE_NAME);
  1278.             $c->add(EtvaNodePeer::ID$this->node_id);
  1279.             $this->aEtvaNode = EtvaNodePeer::doSelectOne($c$con);
  1280.             /* The following can be used additionally to
  1281.                guarantee the related object contains a reference
  1282.                to this object.  This level of coupling may, however, be
  1283.                undesirable since it could result in an only partially populated collection
  1284.                in the referenced object.
  1285.                $this->aEtvaNode->addEtvaLogicalvolumes($this);
  1286.              */
  1287.         }
  1288.         return $this->aEtvaNode;
  1289.     }
  1290.  
  1291.     /**
  1292.      * Clears out the collEtvaServers collection (array).
  1293.      *
  1294.      * This does not modify the database; however, it will remove any associated objects, causing
  1295.      * them to be refetched by subsequent calls to accessor method.
  1296.      *
  1297.      * @return     void 
  1298.      * @see        addEtvaServers()
  1299.      */
  1300.     public function clearEtvaServers()
  1301.     {
  1302.         $this->collEtvaServers = null// important to set this to NULL since that means it is uninitialized
  1303.     }
  1304.  
  1305.     /**
  1306.      * Initializes the collEtvaServers collection (array).
  1307.      *
  1308.      * By default this just sets the collEtvaServers collection to an empty array (like clearcollEtvaServers());
  1309.      * however, you may wish to override this method in your stub class to provide setting appropriate
  1310.      * to your application -- for example, setting the initial array to the values stored in database.
  1311.      *
  1312.      * @return     void 
  1313.      */
  1314.     public function initEtvaServers()
  1315.     {
  1316.         $this->collEtvaServers = array();
  1317.     }
  1318.  
  1319.     /**
  1320.      * Gets an array of EtvaServer objects which contain a foreign key that references this object.
  1321.      *
  1322.      * If this collection has already been initialized with an identical Criteria, it returns the collection.
  1323.      * Otherwise if this EtvaLogicalvolume has previously been saved, it will retrieve
  1324.      * related EtvaServers from storage. If this EtvaLogicalvolume is new, it will return
  1325.      * an empty collection or the current collection, the criteria is ignored on a new object.
  1326.      *
  1327.      * @param      PropelPDO $con 
  1328.      * @param      Criteria $criteria 
  1329.      * @return     array EtvaServer[]
  1330.      * @throws     PropelException
  1331.      */
  1332.     public function getEtvaServers($criteria nullPropelPDO $con null)
  1333.     {
  1334.         if ($criteria === null{
  1335.             $criteria new Criteria(EtvaLogicalvolumePeer::DATABASE_NAME);
  1336.         }
  1337.         elseif ($criteria instanceof Criteria)
  1338.         {
  1339.             $criteria clone $criteria;
  1340.         }
  1341.  
  1342.         if ($this->collEtvaServers === null{
  1343.             if ($this->isNew()) {
  1344.                $this->collEtvaServers = array();
  1345.             else {
  1346.  
  1347.                 $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1348.  
  1349.                 EtvaServerPeer::addSelectColumns($criteria);
  1350.                 $this->collEtvaServers = EtvaServerPeer::doSelect($criteria$con);
  1351.             }
  1352.         else {
  1353.             // criteria has no effect for a new object
  1354.             if (!$this->isNew()) {
  1355.                 // the following code is to determine if a new query is
  1356.                 // called for.  If the criteria is the same as the last
  1357.                 // one, just return the collection.
  1358.  
  1359.  
  1360.                 $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1361.  
  1362.                 EtvaServerPeer::addSelectColumns($criteria);
  1363.                 if (!isset($this->lastEtvaServerCriteria|| !$this->lastEtvaServerCriteria->equals($criteria)) {
  1364.                     $this->collEtvaServers = EtvaServerPeer::doSelect($criteria$con);
  1365.                 }
  1366.             }
  1367.         }
  1368.         $this->lastEtvaServerCriteria $criteria;
  1369.         return $this->collEtvaServers;
  1370.     }
  1371.  
  1372.     /**
  1373.      * Returns the number of related EtvaServer objects.
  1374.      *
  1375.      * @param      Criteria $criteria 
  1376.      * @param      boolean $distinct 
  1377.      * @param      PropelPDO $con 
  1378.      * @return     int Count of related EtvaServer objects.
  1379.      * @throws     PropelException
  1380.      */
  1381.     public function countEtvaServers(Criteria $criteria null$distinct falsePropelPDO $con null)
  1382.     {
  1383.         if ($criteria === null{
  1384.             $criteria new Criteria(EtvaLogicalvolumePeer::DATABASE_NAME);
  1385.         else {
  1386.             $criteria clone $criteria;
  1387.         }
  1388.  
  1389.         if ($distinct{
  1390.             $criteria->setDistinct();
  1391.         }
  1392.  
  1393.         $count null;
  1394.  
  1395.         if ($this->collEtvaServers === null{
  1396.             if ($this->isNew()) {
  1397.                 $count 0;
  1398.             else {
  1399.  
  1400.                 $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1401.  
  1402.                 $count EtvaServerPeer::doCount($criteria$con);
  1403.             }
  1404.         else {
  1405.             // criteria has no effect for a new object
  1406.             if (!$this->isNew()) {
  1407.                 // the following code is to determine if a new query is
  1408.                 // called for.  If the criteria is the same as the last
  1409.                 // one, just return count of the collection.
  1410.  
  1411.  
  1412.                 $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1413.  
  1414.                 if (!isset($this->lastEtvaServerCriteria|| !$this->lastEtvaServerCriteria->equals($criteria)) {
  1415.                     $count EtvaServerPeer::doCount($criteria$con);
  1416.                 else {
  1417.                     $count count($this->collEtvaServers);
  1418.                 }
  1419.             else {
  1420.                 $count count($this->collEtvaServers);
  1421.             }
  1422.         }
  1423.         $this->lastEtvaServerCriteria $criteria;
  1424.         return $count;
  1425.     }
  1426.  
  1427.     /**
  1428.      * Method called to associate a EtvaServer object to this object
  1429.      * through the EtvaServer foreign key attribute.
  1430.      *
  1431.      * @param      EtvaServer $l EtvaServer
  1432.      * @return     void 
  1433.      * @throws     PropelException
  1434.      */
  1435.     public function addEtvaServer(EtvaServer $l)
  1436.     {
  1437.         if ($this->collEtvaServers === null{
  1438.             $this->initEtvaServers();
  1439.         }
  1440.         if (!in_array($l$this->collEtvaServerstrue)) // only add it if the **same** object is not already associated
  1441.             array_push($this->collEtvaServers$l);
  1442.             $l->setEtvaLogicalvolume($this);
  1443.         }
  1444.     }
  1445.  
  1446.  
  1447.     /**
  1448.      * If this collection has already been initialized with
  1449.      * an identical criteria, it returns the collection.
  1450.      * Otherwise if this EtvaLogicalvolume is new, it will return
  1451.      * an empty collection; or if this EtvaLogicalvolume has previously
  1452.      * been saved, it will retrieve related EtvaServers from storage.
  1453.      *
  1454.      * This method is protected by default in order to keep the public
  1455.      * api reasonable.  You can provide public methods for those you
  1456.      * actually need in EtvaLogicalvolume.
  1457.      */
  1458.     public function getEtvaServersJoinEtvaNode($criteria null$con null$join_behavior Criteria::LEFT_JOIN)
  1459.     {
  1460.         if ($criteria === null{
  1461.             $criteria new Criteria(EtvaLogicalvolumePeer::DATABASE_NAME);
  1462.         }
  1463.         elseif ($criteria instanceof Criteria)
  1464.         {
  1465.             $criteria clone $criteria;
  1466.         }
  1467.  
  1468.         if ($this->collEtvaServers === null{
  1469.             if ($this->isNew()) {
  1470.                 $this->collEtvaServers = array();
  1471.             else {
  1472.  
  1473.                 $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1474.  
  1475.                 $this->collEtvaServers = EtvaServerPeer::doSelectJoinEtvaNode($criteria$con$join_behavior);
  1476.             }
  1477.         else {
  1478.             // the following code is to determine if a new query is
  1479.             // called for.  If the criteria is the same as the last
  1480.             // one, just return the collection.
  1481.  
  1482.             $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1483.  
  1484.             if (!isset($this->lastEtvaServerCriteria|| !$this->lastEtvaServerCriteria->equals($criteria)) {
  1485.                 $this->collEtvaServers = EtvaServerPeer::doSelectJoinEtvaNode($criteria$con$join_behavior);
  1486.             }
  1487.         }
  1488.         $this->lastEtvaServerCriteria $criteria;
  1489.  
  1490.         return $this->collEtvaServers;
  1491.     }
  1492.  
  1493.  
  1494.     /**
  1495.      * If this collection has already been initialized with
  1496.      * an identical criteria, it returns the collection.
  1497.      * Otherwise if this EtvaLogicalvolume is new, it will return
  1498.      * an empty collection; or if this EtvaLogicalvolume has previously
  1499.      * been saved, it will retrieve related EtvaServers from storage.
  1500.      *
  1501.      * This method is protected by default in order to keep the public
  1502.      * api reasonable.  You can provide public methods for those you
  1503.      * actually need in EtvaLogicalvolume.
  1504.      */
  1505.     public function getEtvaServersJoinsfGuardGroup($criteria null$con null$join_behavior Criteria::LEFT_JOIN)
  1506.     {
  1507.         if ($criteria === null{
  1508.             $criteria new Criteria(EtvaLogicalvolumePeer::DATABASE_NAME);
  1509.         }
  1510.         elseif ($criteria instanceof Criteria)
  1511.         {
  1512.             $criteria clone $criteria;
  1513.         }
  1514.  
  1515.         if ($this->collEtvaServers === null{
  1516.             if ($this->isNew()) {
  1517.                 $this->collEtvaServers = array();
  1518.             else {
  1519.  
  1520.                 $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1521.  
  1522.                 $this->collEtvaServers = EtvaServerPeer::doSelectJoinsfGuardGroup($criteria$con$join_behavior);
  1523.             }
  1524.         else {
  1525.             // the following code is to determine if a new query is
  1526.             // called for.  If the criteria is the same as the last
  1527.             // one, just return the collection.
  1528.  
  1529.             $criteria->add(EtvaServerPeer::LOGICALVOLUME_ID$this->id);
  1530.  
  1531.             if (!isset($this->lastEtvaServerCriteria|| !$this->lastEtvaServerCriteria->equals($criteria)) {
  1532.                 $this->collEtvaServers = EtvaServerPeer::doSelectJoinsfGuardGroup($criteria$con$join_behavior);
  1533.             }
  1534.         }
  1535.         $this->lastEtvaServerCriteria $criteria;
  1536.  
  1537.         return $this->collEtvaServers;
  1538.     }
  1539.  
  1540.     /**
  1541.      * Resets all collections of referencing foreign keys.
  1542.      *
  1543.      * This method is a user-space workaround for PHP's inability to garbage collect objects
  1544.      * with circular references.  This is currently necessary when using Propel in certain
  1545.      * daemon or large-volumne/high-memory operations.
  1546.      *
  1547.      * @param      boolean $deep Whether to also clear the references on all associated objects.
  1548.      */
  1549.     public function clearAllReferences($deep false)
  1550.     {
  1551.         if ($deep{
  1552.             if ($this->collEtvaServers{
  1553.                 foreach ((array) $this->collEtvaServers as $o{
  1554.                     $o->clearAllReferences($deep);
  1555.                 }
  1556.             }
  1557.         // if ($deep)
  1558.  
  1559.         $this->collEtvaServers = null;
  1560.             $this->aEtvaVolumegroup = null;
  1561.             $this->aEtvaNode = null;
  1562.     }
  1563.  
  1564.  
  1565.   public function __call($method$arguments)
  1566.   {
  1567.     if (!$callable sfMixer::getCallable('BaseEtvaLogicalvolume:'.$method))
  1568.     {
  1569.       throw new sfException(sprintf('Call to undefined method BaseEtvaLogicalvolume::%s'$method));
  1570.     }
  1571.  
  1572.     array_unshift($arguments$this);
  1573.  
  1574.     return call_user_func_array($callable$arguments);
  1575.   }
  1576.  
  1577.  
  1578. // BaseEtvaLogicalvolume

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