/** * Gets the SQL value for the ENUM column value * * @param string $colname ENUM column name. * @param string $enumVal ENUM value. * * @return int SQL value */ public static function getSqlValueForEnum($colname, $enumVal) { $values = ProductPeer::getValueSet($colname); if (!in_array($enumVal, $values)) { throw new PropelException(sprintf('Value "%s" is not accepted in this enumerated column', $colname)); } return array_search($enumVal, $values); }
/** * 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->setPrincipalId($value); break; case 2: $this->setName($value); break; case 3: $this->setNameSlug($value); break; case 4: $this->setCategory($value); break; case 5: $valueSet = ProductPeer::getValueSet(ProductPeer::UNIT); if (isset($valueSet[$value])) { $value = $valueSet[$value]; } $this->setUnit($value); break; case 6: $this->setPrice($value); break; case 7: $this->setDescription($value); break; case 8: $this->setSortableRank($value); break; case 9: $this->setCreatedAt($value); break; case 10: $this->setUpdatedAt($value); break; } // switch() }