Пример #1
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Recipe $obj A Recipe object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getDataId();
         }
         // if key === null
         RecipePeer::$instances[$key] = $obj;
     }
 }
Пример #2
0
 /**
  * Filter the query by a related Recipe object
  *
  * @param   Recipe|PropelObjectCollection $recipe  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return   DisciplineQuery The current query, for fluid interface
  * @throws   PropelException - if the provided filter is invalid.
  */
 public function filterByRecipe($recipe, $comparison = null)
 {
     if ($recipe instanceof Recipe) {
         return $this->addUsingAlias(DisciplinePeer::ID, $recipe->getDisciplineId(), $comparison);
     } elseif ($recipe instanceof PropelObjectCollection) {
         return $this->useRecipeQuery()->filterByPrimaryKeys($recipe->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByRecipe() only accepts arguments of type Recipe or PropelCollection');
     }
 }
Пример #3
0
 public function buildRecipeDataArray(Recipe $recipe)
 {
     $resultItem = $recipe->getResultItem();
     $data = array("data_id" => $recipe->getDataId(), "name" => $recipe->getName(), "result_count" => $recipe->getCount(), "result_item_data_id" => $recipe->getResultItemId(), "discipline_id" => $recipe->getDisciplineId(), "result_item_max_offer_unit_price" => $resultItem ? $resultItem->getMaxOfferUnitPrice() : 0, "result_item_min_sale_unit_price" => $resultItem ? $resultItem->getMinSaleUnitPrice() : 0, "crafting_cost" => $recipe->getCost(), "rating" => $recipe->getRating());
     return $data;
 }
Пример #4
0
 /**
  * @param	Recipe $recipe The recipe object to add.
  */
 protected function doAddRecipe($recipe)
 {
     $this->collRecipes[] = $recipe;
     $recipe->setDiscipline($this);
 }
 /**
  * Filter the query by a related Recipe object
  *
  * @param   Recipe|PropelObjectCollection $recipe The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return   RecipeIngredientQuery The current query, for fluid interface
  * @throws   PropelException - if the provided filter is invalid.
  */
 public function filterByRecipe($recipe, $comparison = null)
 {
     if ($recipe instanceof Recipe) {
         return $this->addUsingAlias(RecipeIngredientPeer::RECIPE_ID, $recipe->getDataId(), $comparison);
     } elseif ($recipe instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(RecipeIngredientPeer::RECIPE_ID, $recipe->toKeyValue('PrimaryKey', 'DataId'), $comparison);
     } else {
         throw new PropelException('filterByRecipe() only accepts arguments of type Recipe or PropelCollection');
     }
 }
Пример #6
0
 /**
  * Declares an association between this object and a Recipe object.
  *
  * @param                  Recipe $v
  * @return                 RecipeIngredient The current object (for fluent API support)
  * @throws PropelException
  */
 public function setRecipe(Recipe $v = null)
 {
     if ($v === null) {
         $this->setRecipeId(NULL);
     } else {
         $this->setRecipeId($v->getDataId());
     }
     $this->aRecipe = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Recipe object, it will not be re-added.
     if ($v !== null) {
         $v->addIngredient($this);
     }
     return $this;
 }