Пример #1
0
 /**
  * Filter the query on the state column
  *
  * @param     mixed $state The value to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return $this|ChildSubNoteQuery The current query, for fluid interface
  */
 public function filterByState($state = null, $comparison = null)
 {
     $valueSet = SubNoteTableMap::getValueSet(SubNoteTableMap::COL_STATE);
     if (is_scalar($state)) {
         if (!in_array($state, $valueSet)) {
             throw new PropelException(sprintf('Value "%s" is not accepted in this enumerated column', $state));
         }
         $state = array_search($state, $valueSet);
     } elseif (is_array($state)) {
         $convertedValues = array();
         foreach ($state 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);
         }
         $state = $convertedValues;
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
     }
     return $this->addUsingAlias(SubNoteTableMap::COL_STATE, $state, $comparison);
 }
Пример #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\SubNote
  */
 public function setByPosition($pos, $value)
 {
     switch ($pos) {
         case 0:
             $this->setId($value);
             break;
         case 1:
             $this->setNoteId($value);
             break;
         case 2:
             $this->setText($value);
             break;
         case 3:
             $valueSet = SubNoteTableMap::getValueSet(SubNoteTableMap::COL_STATE);
             if (isset($valueSet[$value])) {
                 $value = $valueSet[$value];
             }
             $this->setState($value);
             break;
         case 4:
             $this->setDoneAt($value);
             break;
         case 5:
             $this->setCreatedAt($value);
             break;
         case 6:
             $this->setUpdatedAt($value);
             break;
     }
     // switch()
     return $this;
 }