/**
  * 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 $this|ChildNotificationQuery The current query, for fluid interface
  */
 public function filterByType($type = null, $comparison = null)
 {
     $valueSet = NotificationTableMap::getValueSet(NotificationTableMap::COL_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(NotificationTableMap::COL_TYPE, $type, $comparison);
 }
Exemple #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 $this|\Models\Notification
  */
 public function setByPosition($pos, $value)
 {
     switch ($pos) {
         case 0:
             $this->setId($value);
             break;
         case 1:
             $this->setUserId($value);
             break;
         case 2:
             $this->setOriginId($value);
             break;
         case 3:
             $this->setOriginType($value);
             break;
         case 4:
             $valueSet = NotificationTableMap::getValueSet(NotificationTableMap::COL_TYPE);
             if (isset($valueSet[$value])) {
                 $value = $valueSet[$value];
             }
             $this->setType($value);
             break;
         case 5:
             $this->setText($value);
             break;
         case 6:
             $this->setCreatedAt($value);
             break;
         case 7:
             $this->setUpdatedAt($value);
             break;
     }
     // switch()
     return $this;
 }