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

Source for file BaseEtvaVncTokens.php

Documentation is available at BaseEtvaVncTokens.php

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

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