/** * Get value of a int key ENUM * @param int $v * @throws PropelException - if the key is not accepted by this enum * @return string */ public static function getTypeValue($v) { $valueSet = MealPeer::getValueSet(MealPeer::TYPE); if (!isset($valueSet[$v])) { throw new PropelException('Unknown stored enum key: ' . $v); } return $valueSet[$v]; }
/** * Add Meal Reference by type and date * Forseeing enhancement * @param array (type and day keys) */ public function addMealByTypeAndDate($mealsRef, $number) { $meals = MealPeer::doSelect(new Criteria()); foreach ($meals as $meal) { foreach ($mealsRef as $mealRef) { if (Meal::getTypeIndex($meal->getType()) == $mealRef['type'] && $meal->getDayDate() == $mealRef['day']) { $usermeal = new Usermeal(); $usermeal->setUserId($this->getId()); $usermeal->setMealId($meal->getId()); $usermeal->setNumber($number); $usermeal->save(); } } } }