示例#1
0
 /**
  * Declares an association between this object and a ChildWine object.
  *
  * @param  ChildWine $v
  * @return $this|\WineTasting\Model\User The current object (for fluent API support)
  * @throws PropelException
  */
 public function setWineRelatedByVote3(ChildWine $v = null)
 {
     if ($v === null) {
         $this->setVote3(NULL);
     } else {
         $this->setVote3($v->getIdWine());
     }
     $this->aWineRelatedByVote3 = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildWine object, it will not be re-added.
     if ($v !== null) {
         $v->addUserRelatedByVote3($this);
     }
     return $this;
 }
 private function calculatePoints(Wine $wine)
 {
     $vote3 = count(UserQuery::create()->findByVote3($wine->getIdWine()));
     $vote2 = count(UserQuery::create()->findByVote2($wine->getIdWine()));
     $vote1 = count(UserQuery::create()->findByVote1($wine->getIdWine()));
     return $vote3 * 3 + $vote2 * 2 + $vote1;
 }
 /**
  * Filter the query by a related \WineTasting\Model\Wine object
  *
  * @param \WineTasting\Model\Wine|ObjectCollection $wine The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildTastedWineQuery The current query, for fluid interface
  */
 public function filterByWine($wine, $comparison = null)
 {
     if ($wine instanceof \WineTasting\Model\Wine) {
         return $this->addUsingAlias(TastedWineTableMap::COL_IDWINE, $wine->getIdWine(), $comparison);
     } elseif ($wine instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(TastedWineTableMap::COL_IDWINE, $wine->toKeyValue('PrimaryKey', 'IdWine'), $comparison);
     } else {
         throw new PropelException('filterByWine() only accepts arguments of type \\WineTasting\\Model\\Wine or Collection');
     }
 }
示例#4
0
 /**
  * Exclude object from result
  *
  * @param   ChildWine $wine Object to remove from the list of results
  *
  * @return $this|ChildWineQuery The current query, for fluid interface
  */
 public function prune($wine = null)
 {
     if ($wine) {
         $this->addUsingAlias(WineTableMap::COL_IDWINE, $wine->getIdWine(), Criteria::NOT_EQUAL);
     }
     return $this;
 }