Example #1
0
 /**
  * Filter the query on the unit column
  *
  * @param     mixed $unit The value to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ProductQuery The current query, for fluid interface
  * @throws PropelException - if the value is not accepted by the enum.
  */
 public function filterByUnit($unit = null, $comparison = null)
 {
     if (is_scalar($unit)) {
         $unit = ProductPeer::getSqlValueForEnum(ProductPeer::UNIT, $unit);
     } elseif (is_array($unit)) {
         $convertedValues = array();
         foreach ($unit as $value) {
             $convertedValues[] = ProductPeer::getSqlValueForEnum(ProductPeer::UNIT, $value);
         }
         $unit = $convertedValues;
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
     }
     return $this->addUsingAlias(ProductPeer::UNIT, $unit, $comparison);
 }
Example #2
0
 /**
  * Gets the SQL value for Unit ENUM value
  *
  * @param  string $enumVal ENUM value to get SQL value for
  * @return int SQL value
  */
 public static function getUnitSqlValue($enumVal)
 {
     return ProductPeer::getSqlValueForEnum(ProductPeer::UNIT, $enumVal);
 }