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

Source for file BaseEtvaVolumePhysical.php

Documentation is available at BaseEtvaVolumePhysical.php

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

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