Beispiel #1
0
 /**
  * Filter the query on the type column
  *
  * @param     mixed $type The value to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    CommentQuery The current query, for fluid interface
  */
 public function filterByType($type = null, $comparison = null)
 {
     $valueSet = CommentPeer::getValueSet(CommentPeer::TYPE);
     if (is_scalar($type)) {
         if (!in_array($type, $valueSet)) {
             throw new PropelException(sprintf('Value "%s" is not accepted in this enumerated column', $type));
         }
         $type = array_search($type, $valueSet);
     } elseif (is_array($type)) {
         $convertedValues = array();
         foreach ($type as $value) {
             if (!in_array($value, $valueSet)) {
                 throw new PropelException(sprintf('Value "%s" is not accepted in this enumerated column', $value));
             }
             $convertedValues[] = array_search($value, $valueSet);
         }
         $type = $convertedValues;
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
     }
     return $this->addUsingAlias(CommentPeer::TYPE, $type, $comparison);
 }
Beispiel #2
0
 /**
  * Sets a field from the object by Position as specified in the xml schema.
  * Zero-based.
  *
  * @param      int $pos position in xml schema
  * @param      mixed $value field value
  * @return     void
  */
 public function setByPosition($pos, $value)
 {
     switch ($pos) {
         case 0:
             $this->setId($value);
             break;
         case 1:
             $this->setUserId($value);
             break;
         case 2:
             $this->setBranchId($value);
             break;
         case 3:
             $this->setFileId($value);
             break;
         case 4:
             $this->setPosition($value);
             break;
         case 5:
             $this->setLine($value);
             break;
         case 6:
             $valueSet = CommentPeer::getValueSet(CommentPeer::TYPE);
             if (isset($valueSet[$value])) {
                 $value = $valueSet[$value];
             }
             $this->setType($value);
             break;
         case 7:
             $this->setCommit($value);
             break;
         case 8:
             $this->setValue($value);
             break;
         case 9:
             $this->setRootCommentId($value);
             break;
         case 10:
             $this->setCheckUserId($value);
             break;
         case 11:
             $this->setCheckedAt($value);
             break;
         case 12:
             $this->setCreatedAt($value);
             break;
         case 13:
             $this->setUpdatedAt($value);
             break;
     }
     // switch()
 }