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

Source for file BaseEtvaVncToken.php

Documentation is available at BaseEtvaVncToken.php

  1. <?php
  2.  
  3. /**
  4.  * Base class that represents a row from the 'vnc_token' 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 BaseEtvaVncToken extends BaseObject  implements Persistent {
  15.  
  16.  
  17.   const PEER = 'EtvaVncTokenPeer';
  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        EtvaVncTokenPeer 
  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        string 
  36.      */
  37.     protected $token;
  38.  
  39.     /**
  40.      * The value for the enctoken field.
  41.      * @var        string 
  42.      */
  43.     protected $enctoken;
  44.  
  45.     /**
  46.      * The value for the user_id field.
  47.      * @var        int 
  48.      */
  49.     protected $user_id;
  50.  
  51.     /**
  52.      * The value for the created_at field.
  53.      * @var        string 
  54.      */
  55.     protected $created_at;
  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 BaseEtvaVncToken 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     string 
  110.      */
  111.     public function getToken()
  112.     {
  113.         return $this->token;
  114.     }
  115.  
  116.     /**
  117.      * Get the [enctoken] column value.
  118.      * 
  119.      * @return     string 
  120.      */
  121.     public function getEnctoken()
  122.     {
  123.         return $this->enctoken;
  124.     }
  125.  
  126.     /**
  127.      * Get the [user_id] column value.
  128.      * 
  129.      * @return     int 
  130.      */
  131.     public function getUserId()
  132.     {
  133.         return $this->user_id;
  134.     }
  135.  
  136.     /**
  137.      * Get the [optionally formatted] temporal [created_at] column value.
  138.      * 
  139.      *
  140.      * @param      string $format The date/time format string (either date()-style or strftime()-style).
  141.      *                             If format is NULL, then the raw DateTime object will be returned.
  142.      * @return     mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  143.      * @throws     PropelException - if unable to parse/validate the date/time value.
  144.      */
  145.     public function getCreatedAt($format 'Y-m-d H:i:s')
  146.     {
  147.         if ($this->created_at === null{
  148.             return null;
  149.         }
  150.  
  151.  
  152.  
  153.         try {
  154.             $dt new DateTime($this->created_at);
  155.         catch (Exception $x{
  156.             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " var_export($this->created_attrue)$x);
  157.         }
  158.  
  159.         if ($format === null{
  160.             // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  161.             return $dt;
  162.         elseif (strpos($format'%'!== false{
  163.             return strftime($format$dt->format('U'));
  164.         else {
  165.             return $dt->format($format);
  166.         }
  167.     }
  168.  
  169.     /**
  170.      * Set the value of [username] column.
  171.      * 
  172.      * @param      string $v new value
  173.      * @return     EtvaVncToken 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[EtvaVncTokenPeer::USERNAME;
  184.         }
  185.  
  186.         return $this;
  187.     // setUsername()
  188.  
  189.     /**
  190.      * Set the value of [token] column.
  191.      * 
  192.      * @param      string $v new value
  193.      * @return     EtvaVncToken The current object (for fluent API support)
  194.      */
  195.     public function setToken($v)
  196.     {
  197.         if ($v !== null{
  198.             $v = (string) $v;
  199.         }
  200.  
  201.         if ($this->token !== $v{
  202.             $this->token = $v;
  203.             $this->modifiedColumns[EtvaVncTokenPeer::TOKEN;
  204.         }
  205.  
  206.         return $this;
  207.     // setToken()
  208.  
  209.     /**
  210.      * Set the value of [enctoken] column.
  211.      * 
  212.      * @param      string $v new value
  213.      * @return     EtvaVncToken The current object (for fluent API support)
  214.      */
  215.     public function setEnctoken($v)
  216.     {
  217.         if ($v !== null{
  218.             $v = (string) $v;
  219.         }
  220.  
  221.         if ($this->enctoken !== $v{
  222.             $this->enctoken = $v;
  223.             $this->modifiedColumns[EtvaVncTokenPeer::ENCTOKEN;
  224.         }
  225.  
  226.         return $this;
  227.     // setEnctoken()
  228.  
  229.     /**
  230.      * Set the value of [user_id] column.
  231.      * 
  232.      * @param      int $v new value
  233.      * @return     EtvaVncToken The current object (for fluent API support)
  234.      */
  235.     public function setUserId($v)
  236.     {
  237.         if ($v !== null{
  238.             $v = (int) $v;
  239.         }
  240.  
  241.         if ($this->user_id !== $v{
  242.             $this->user_id = $v;
  243.             $this->modifiedColumns[EtvaVncTokenPeer::USER_ID;
  244.         }
  245.  
  246.         if ($this->asfGuardUser !== null && $this->asfGuardUser->getId(!== $v{
  247.             $this->asfGuardUser = null;
  248.         }
  249.  
  250.         return $this;
  251.     // setUserId()
  252.  
  253.     /**
  254.      * Sets the value of [created_at] column to a normalized version of the date/time value specified.
  255.      * 
  256.      * @param      mixed $v string, integer (timestamp), or DateTime value.  Empty string will
  257.      *                         be treated as NULL for temporal objects.
  258.      * @return     EtvaVncToken The current object (for fluent API support)
  259.      */
  260.     public function setCreatedAt($v)
  261.     {
  262.         // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  263.         // -- which is unexpected, to say the least.
  264.         if ($v === null || $v === ''{
  265.             $dt null;
  266.         elseif ($v instanceof DateTime{
  267.             $dt $v;
  268.         else {
  269.             // some string/numeric value passed; we normalize that so that we can
  270.             // validate it.
  271.             try {
  272.                 if (is_numeric($v)) // if it's a unix timestamp
  273.                     $dt new DateTime('@'.$vnew DateTimeZone('UTC'));
  274.                     // We have to explicitly specify and then change the time zone because of a
  275.                     // DateTime bug: http://bugs.php.net/bug.php?id=43003
  276.                     $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  277.                 else {
  278.                     $dt new DateTime($v);
  279.                 }
  280.             catch (Exception $x{
  281.                 throw new PropelException('Error parsing date/time value: ' var_export($vtrue)$x);
  282.             }
  283.         }
  284.  
  285.         if $this->created_at !== null || $dt !== null {
  286.             // (nested ifs are a little easier to read in this case)
  287.  
  288.             $currNorm ($this->created_at !== null && $tmpDt new DateTime($this->created_at)) $tmpDt->format('Y-m-d\\TH:i:sO'null;
  289.             $newNorm ($dt !== null$dt->format('Y-m-d\\TH:i:sO'null;
  290.  
  291.             if ( ($currNorm !== $newNorm// normalized values don't match 
  292.                     )
  293.             {
  294.                 $this->created_at = ($dt $dt->format('Y-m-d\\TH:i:sO'null);
  295.                 $this->modifiedColumns[EtvaVncTokenPeer::CREATED_AT;
  296.             }
  297.         // if either are not null
  298.  
  299.         return $this;
  300.     // setCreatedAt()
  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? (string) $row[$startcol 1null;
  341.             $this->enctoken = ($row[$startcol 2!== null? (string) $row[$startcol 2null;
  342.             $this->user_id = ($row[$startcol 3!== null? (int) $row[$startcol 3null;
  343.             $this->created_at = ($row[$startcol 4!== null? (string) $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 = EtvaVncTokenPeer::NUM_COLUMNS - EtvaVncTokenPeer::NUM_LAZY_LOAD_COLUMNS).
  354.  
  355.         catch (Exception $e{
  356.             throw new PropelException("Error populating EtvaVncToken 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(EtvaVncTokenPeer::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 EtvaVncTokenPeer::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('BaseEtvaVncToken: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(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  450.         }
  451.         
  452.         $con->beginTransaction();
  453.         try {
  454.             EtvaVncTokenPeer::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('BaseEtvaVncToken: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('BaseEtvaVncToken: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->isNew(&& !$this->isColumnModified(EtvaVncTokenPeer::CREATED_AT))
  496.     {
  497.       $this->setCreatedAt(time());
  498.     }
  499.  
  500.         if ($this->isDeleted()) {
  501.             throw new PropelException("You cannot save an object that has been deleted.");
  502.         }
  503.  
  504.         if ($con === null{
  505.             $con Propel::getConnection(EtvaVncTokenPeer::DATABASE_NAMEPropel::CONNECTION_WRITE);
  506.         }
  507.         
  508.         $con->beginTransaction();
  509.         try {
  510.             $affectedRows $this->doSave($con);
  511.             $con->commit();
  512.     foreach (sfMixer::getCallables('BaseEtvaVncToken:save:post'as $callable)
  513.     {
  514.       call_user_func($callable$this$con$affectedRows);
  515.     }
  516.  
  517.             EtvaVncTokenPeer::addInstanceToPool($this);
  518.             return $affectedRows;
  519.         catch (PropelException $e{
  520.             $con->rollBack();
  521.             throw $e;
  522.         }
  523.     }
  524.  
  525.     /**
  526.      * Performs the work of inserting or updating the row in the database.
  527.      *
  528.      * If the object is new, it inserts it; otherwise an update is performed.
  529.      * All related objects are also updated in this method.
  530.      *
  531.      * @param      PropelPDO $con 
  532.      * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  533.      * @throws     PropelException
  534.      * @see        save()
  535.      */
  536.     protected function doSave(PropelPDO $con)
  537.     {
  538.         $affectedRows 0// initialize var to track total num of affected rows
  539.         if (!$this->alreadyInSave{
  540.             $this->alreadyInSave = true;
  541.  
  542.             // We call the save method on the following object(s) if they
  543.             // were passed to this object by their coresponding set
  544.             // method.  This object relates to these object(s) by a
  545.             // foreign key reference.
  546.  
  547.             if ($this->asfGuardUser !== null{
  548.                 if ($this->asfGuardUser->isModified(|| $this->asfGuardUser->isNew()) {
  549.                     $affectedRows += $this->asfGuardUser->save($con);
  550.                 }
  551.                 $this->setsfGuardUser($this->asfGuardUser);
  552.             }
  553.  
  554.  
  555.             // If this object has been modified, then save it to the database.
  556.             if ($this->isModified()) {
  557.                 if ($this->isNew()) {
  558.                     $pk EtvaVncTokenPeer::doInsert($this$con);
  559.                     $affectedRows += 1// we are assuming that there is only 1 row per doInsert() which
  560.                                          // should always be true here (even though technically
  561.                                          // BasePeer::doInsert() can insert multiple rows).
  562.  
  563.                     $this->setNew(false);
  564.                 else {
  565.                     $affectedRows += EtvaVncTokenPeer::doUpdate($this$con);
  566.                 }
  567.  
  568.                 $this->resetModified()// [HL] After being saved an object is no longer 'modified'
  569.             }
  570.  
  571.             $this->alreadyInSave = false;
  572.  
  573.         }
  574.         return $affectedRows;
  575.     // doSave()
  576.  
  577.     /**
  578.      * Array of ValidationFailed objects.
  579.      * @var        array ValidationFailed[]
  580.      */
  581.     protected $validationFailures = array();
  582.  
  583.     /**
  584.      * Gets any ValidationFailed objects that resulted from last call to validate().
  585.      *
  586.      *
  587.      * @return     array ValidationFailed[]
  588.      * @see        validate()
  589.      */
  590.     public function getValidationFailures()
  591.     {
  592.         return $this->validationFailures;
  593.     }
  594.  
  595.     /**
  596.      * Validates the objects modified field values and all objects related to this table.
  597.      *
  598.      * If $columns is either a column name or an array of column names
  599.      * only those columns are validated.
  600.      *
  601.      * @param      mixed $columns Column name or an array of column names.
  602.      * @return     boolean Whether all columns pass validation.
  603.      * @see        doValidate()
  604.      * @see        getValidationFailures()
  605.      */
  606.     public function validate($columns null)
  607.     {
  608.         $res $this->doValidate($columns);
  609.         if ($res === true{
  610.             $this->validationFailures = array();
  611.             return true;
  612.         else {
  613.             $this->validationFailures = $res;
  614.             return false;
  615.         }
  616.     }
  617.  
  618.     /**
  619.      * This function performs the validation work for complex object models.
  620.      *
  621.      * In addition to checking the current object, all related objects will
  622.      * also be validated.  If all pass then <code>true</code> is returned; otherwise
  623.      * an aggreagated array of ValidationFailed objects will be returned.
  624.      *
  625.      * @param      array $columns Array of column names to validate.
  626.      * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  627.      */
  628.     protected function doValidate($columns null)
  629.     {
  630.         if (!$this->alreadyInValidation{
  631.             $this->alreadyInValidation = true;
  632.             $retval null;
  633.  
  634.             $failureMap array();
  635.  
  636.  
  637.             // We call the validate method on the following object(s) if they
  638.             // were passed to this object by their coresponding set
  639.             // method.  This object relates to these object(s) by a
  640.             // foreign key reference.
  641.  
  642.             if ($this->asfGuardUser !== null{
  643.                 if (!$this->asfGuardUser->validate($columns)) {
  644.                     $failureMap array_merge($failureMap$this->asfGuardUser->getValidationFailures());
  645.                 }
  646.             }
  647.  
  648.  
  649.             if (($retval EtvaVncTokenPeer::doValidate($this$columns)) !== true{
  650.                 $failureMap array_merge($failureMap$retval);
  651.             }
  652.  
  653.  
  654.  
  655.             $this->alreadyInValidation = false;
  656.         }
  657.  
  658.         return (!empty($failureMap$failureMap true);
  659.     }
  660.  
  661.     /**
  662.      * Retrieves a field from the object by name passed in as a string.
  663.      *
  664.      * @param      string $name name
  665.      * @param      string $type The type of fieldname the $name is of:
  666.      *                      one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  667.      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  668.      * @return     mixed Value of field.
  669.      */
  670.     public function getByName($name$type BasePeer::TYPE_PHPNAME)
  671.     {
  672.         $pos EtvaVncTokenPeer::translateFieldName($name$typeBasePeer::TYPE_NUM);
  673.         $field $this->getByPosition($pos);
  674.         return $field;
  675.     }
  676.  
  677.     /**
  678.      * Retrieves a field from the object by Position as specified in the xml schema.
  679.      * Zero-based.
  680.      *
  681.      * @param      int $pos position in xml schema
  682.      * @return     mixed Value of field at $pos
  683.      */
  684.     public function getByPosition($pos)
  685.     {
  686.         switch($pos{
  687.             case 0:
  688.                 return $this->getUsername();
  689.                 break;
  690.             case 1:
  691.                 return $this->getToken();
  692.                 break;
  693.             case 2:
  694.                 return $this->getEnctoken();
  695.                 break;
  696.             case 3:
  697.                 return $this->getUserId();
  698.                 break;
  699.             case 4:
  700.                 return $this->getCreatedAt();
  701.                 break;
  702.             default:
  703.                 return null;
  704.                 break;
  705.         // switch()
  706.     }
  707.  
  708.     /**
  709.      * Exports the object as an array.
  710.      *
  711.      * You can specify the key type of the array by passing one of the class
  712.      * type constants.
  713.      *
  714.      * @param      string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  715.      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
  716.      * @param      boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns.  Defaults to TRUE.
  717.      * @return     an associative array containing the field names (as keys) and field values
  718.      */
  719.     public function toArray($keyType BasePeer::TYPE_PHPNAME$includeLazyLoadColumns true)
  720.     {
  721.         $keys EtvaVncTokenPeer::getFieldNames($keyType);
  722.         $result array(
  723.             $keys[0=> $this->getUsername(),
  724.             $keys[1=> $this->getToken(),
  725.             $keys[2=> $this->getEnctoken(),
  726.             $keys[3=> $this->getUserId(),
  727.             $keys[4=> $this->getCreatedAt(),
  728.         );
  729.         return $result;
  730.     }
  731.  
  732.     /**
  733.      * Sets a field from the object by name passed in as a string.
  734.      *
  735.      * @param      string $name peer name
  736.      * @param      mixed $value field value
  737.      * @param      string $type The type of fieldname the $name is of:
  738.      *                      one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  739.      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  740.      * @return     void 
  741.      */
  742.     public function setByName($name$value$type BasePeer::TYPE_PHPNAME)
  743.     {
  744.         $pos EtvaVncTokenPeer::translateFieldName($name$typeBasePeer::TYPE_NUM);
  745.         return $this->setByPosition($pos$value);
  746.     }
  747.  
  748.     /**
  749.      * Sets a field from the object by Position as specified in the xml schema.
  750.      * Zero-based.
  751.      *
  752.      * @param      int $pos position in xml schema
  753.      * @param      mixed $value field value
  754.      * @return     void 
  755.      */
  756.     public function setByPosition($pos$value)
  757.     {
  758.         switch($pos{
  759.             case 0:
  760.                 $this->setUsername($value);
  761.                 break;
  762.             case 1:
  763.                 $this->setToken($value);
  764.                 break;
  765.             case 2:
  766.                 $this->setEnctoken($value);
  767.                 break;
  768.             case 3:
  769.                 $this->setUserId($value);
  770.                 break;
  771.             case 4:
  772.                 $this->setCreatedAt($value);
  773.                 break;
  774.         // switch()
  775.     }
  776.  
  777.     /**
  778.      * Populates the object using an array.
  779.      *
  780.      * This is particularly useful when populating an object from one of the
  781.      * request arrays (e.g. $_POST).  This method goes through the column
  782.      * names, checking to see whether a matching key exists in populated
  783.      * array. If so the setByName() method is called for that column.
  784.      *
  785.      * You can specify the key type of the array by additionally passing one
  786.      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  787.      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  788.      * The default key type is the column's phpname (e.g. 'AuthorId')
  789.      *
  790.      * @param      array  $arr     An array to populate the object from.
  791.      * @param      string $keyType The type of keys the array uses.
  792.      * @return     void 
  793.      */
  794.     public function fromArray($arr$keyType BasePeer::TYPE_PHPNAME)
  795.     {
  796.         $keys EtvaVncTokenPeer::getFieldNames($keyType);
  797.  
  798.         if (array_key_exists($keys[0]$arr)) $this->setUsername($arr[$keys[0]]);
  799.         if (array_key_exists($keys[1]$arr)) $this->setToken($arr[$keys[1]]);
  800.         if (array_key_exists($keys[2]$arr)) $this->setEnctoken($arr[$keys[2]]);
  801.         if (array_key_exists($keys[3]$arr)) $this->setUserId($arr[$keys[3]]);
  802.         if (array_key_exists($keys[4]$arr)) $this->setCreatedAt($arr[$keys[4]]);
  803.     }
  804.  
  805.     /**
  806.      * Build a Criteria object containing the values of all modified columns in this object.
  807.      *
  808.      * @return     Criteria The Criteria object containing all modified values.
  809.      */
  810.     public function buildCriteria()
  811.     {
  812.         $criteria new Criteria(EtvaVncTokenPeer::DATABASE_NAME);
  813.  
  814.         if ($this->isColumnModified(EtvaVncTokenPeer::USERNAME)) $criteria->add(EtvaVncTokenPeer::USERNAME$this->username);
  815.         if ($this->isColumnModified(EtvaVncTokenPeer::TOKEN)) $criteria->add(EtvaVncTokenPeer::TOKEN$this->token);
  816.         if ($this->isColumnModified(EtvaVncTokenPeer::ENCTOKEN)) $criteria->add(EtvaVncTokenPeer::ENCTOKEN$this->enctoken);
  817.         if ($this->isColumnModified(EtvaVncTokenPeer::USER_ID)) $criteria->add(EtvaVncTokenPeer::USER_ID$this->user_id);
  818.         if ($this->isColumnModified(EtvaVncTokenPeer::CREATED_AT)) $criteria->add(EtvaVncTokenPeer::CREATED_AT$this->created_at);
  819.  
  820.         return $criteria;
  821.     }
  822.  
  823.     /**
  824.      * Builds a Criteria object containing the primary key for this object.
  825.      *
  826.      * Unlike buildCriteria() this method includes the primary key values regardless
  827.      * of whether or not they have been modified.
  828.      *
  829.      * @return     Criteria The Criteria object containing value(s) for primary key(s).
  830.      */
  831.     public function buildPkeyCriteria()
  832.     {
  833.         $criteria new Criteria(EtvaVncTokenPeer::DATABASE_NAME);
  834.  
  835.         $criteria->add(EtvaVncTokenPeer::USERNAME$this->username);
  836.  
  837.         return $criteria;
  838.     }
  839.  
  840.     /**
  841.      * Returns the primary key for this object (row).
  842.      * @return     string 
  843.      */
  844.     public function getPrimaryKey()
  845.     {
  846.         return $this->getUsername();
  847.     }
  848.  
  849.     /**
  850.      * Generic method to set the primary key (username column).
  851.      *
  852.      * @param      string $key Primary key.
  853.      * @return     void 
  854.      */
  855.     public function setPrimaryKey($key)
  856.     {
  857.         $this->setUsername($key);
  858.     }
  859.  
  860.     /**
  861.      * Sets contents of passed object to values from current object.
  862.      *
  863.      * If desired, this method can also make copies of all associated (fkey referrers)
  864.      * objects.
  865.      *
  866.      * @param      object $copyObj An object of EtvaVncToken (or compatible) type.
  867.      * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  868.      * @throws     PropelException
  869.      */
  870.     public function copyInto($copyObj$deepCopy false)
  871.     {
  872.  
  873.         $copyObj->setUsername($this->username);
  874.  
  875.         $copyObj->setToken($this->token);
  876.  
  877.         $copyObj->setEnctoken($this->enctoken);
  878.  
  879.         $copyObj->setUserId($this->user_id);
  880.  
  881.         $copyObj->setCreatedAt($this->created_at);
  882.  
  883.  
  884.         $copyObj->setNew(true);
  885.  
  886.     }
  887.  
  888.     /**
  889.      * Makes a copy of this object that will be inserted as a new row in table when saved.
  890.      * It creates a new object filling in the simple attributes, but skipping any primary
  891.      * keys that are defined for the table.
  892.      *
  893.      * If desired, this method can also make copies of all associated (fkey referrers)
  894.      * objects.
  895.      *
  896.      * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  897.      * @return     EtvaVncToken Clone of current object.
  898.      * @throws     PropelException
  899.      */
  900.     public function copy($deepCopy false)
  901.     {
  902.         // we use get_class(), because this might be a subclass
  903.         $clazz get_class($this);
  904.         $copyObj new $clazz();
  905.         $this->copyInto($copyObj$deepCopy);
  906.         return $copyObj;
  907.     }
  908.  
  909.     /**
  910.      * Returns a peer instance associated with this om.
  911.      *
  912.      * Since Peer classes are not to have any instance attributes, this method returns the
  913.      * same instance for all member of this class. The method could therefore
  914.      * be static, but this would prevent one from overriding the behavior.
  915.      *
  916.      * @return     EtvaVncTokenPeer 
  917.      */
  918.     public function getPeer()
  919.     {
  920.         if (self::$peer === null{
  921.             self::$peer new EtvaVncTokenPeer();
  922.         }
  923.         return self::$peer;
  924.     }
  925.  
  926.     /**
  927.      * Declares an association between this object and a sfGuardUser object.
  928.      *
  929.      * @param      sfGuardUser $v 
  930.      * @return     EtvaVncToken The current object (for fluent API support)
  931.      * @throws     PropelException
  932.      */
  933.     public function setsfGuardUser(sfGuardUser $v null)
  934.     {
  935.         if ($v === null{
  936.             $this->setUserId(NULL);
  937.         else {
  938.             $this->setUserId($v->getId());
  939.         }
  940.  
  941.         $this->asfGuardUser = $v;
  942.  
  943.         // Add binding for other direction of this n:n relationship.
  944.         // If this object has already been added to the sfGuardUser object, it will not be re-added.
  945.         if ($v !== null{
  946.             $v->addEtvaVncToken($this);
  947.         }
  948.  
  949.         return $this;
  950.     }
  951.  
  952.  
  953.     /**
  954.      * Get the associated sfGuardUser object
  955.      *
  956.      * @param      PropelPDO Optional Connection object.
  957.      * @return     sfGuardUser The associated sfGuardUser object.
  958.      * @throws     PropelException
  959.      */
  960.     public function getsfGuardUser(PropelPDO $con null)
  961.     {
  962.         if ($this->asfGuardUser === null && ($this->user_id !== null)) {
  963.             $c new Criteria(sfGuardUserPeer::DATABASE_NAME);
  964.             $c->add(sfGuardUserPeer::ID$this->user_id);
  965.             $this->asfGuardUser = sfGuardUserPeer::doSelectOne($c$con);
  966.             /* The following can be used additionally to
  967.                guarantee the related object contains a reference
  968.                to this object.  This level of coupling may, however, be
  969.                undesirable since it could result in an only partially populated collection
  970.                in the referenced object.
  971.                $this->asfGuardUser->addEtvaVncTokens($this);
  972.              */
  973.         }
  974.         return $this->asfGuardUser;
  975.     }
  976.  
  977.     /**
  978.      * Resets all collections of referencing foreign keys.
  979.      *
  980.      * This method is a user-space workaround for PHP's inability to garbage collect objects
  981.      * with circular references.  This is currently necessary when using Propel in certain
  982.      * daemon or large-volumne/high-memory operations.
  983.      *
  984.      * @param      boolean $deep Whether to also clear the references on all associated objects.
  985.      */
  986.     public function clearAllReferences($deep false)
  987.     {
  988.         if ($deep{
  989.         // if ($deep)
  990.  
  991.             $this->asfGuardUser = null;
  992.     }
  993.  
  994.  
  995.   public function __call($method$arguments)
  996.   {
  997.     if (!$callable sfMixer::getCallable('BaseEtvaVncToken:'.$method))
  998.     {
  999.       throw new sfException(sprintf('Call to undefined method BaseEtvaVncToken::%s'$method));
  1000.     }
  1001.  
  1002.     array_unshift($arguments$this);
  1003.  
  1004.     return call_user_func_array($callable$arguments);
  1005.   }
  1006.  
  1007.  
  1008. // BaseEtvaVncToken

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