Пример #1
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aUser) {
         $this->aUser->removeTastedWine($this);
     }
     if (null !== $this->aWine) {
         $this->aWine->removeTastedWine($this);
     }
     $this->iduser = null;
     $this->idwine = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Пример #2
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aWineRelatedByVote1) {
         $this->aWineRelatedByVote1->removeUserRelatedByVote1($this);
     }
     if (null !== $this->aWineRelatedByVote2) {
         $this->aWineRelatedByVote2->removeUserRelatedByVote2($this);
     }
     if (null !== $this->aWineRelatedByVote3) {
         $this->aWineRelatedByVote3->removeUserRelatedByVote3($this);
     }
     $this->iduser = null;
     $this->name = null;
     $this->vote1 = null;
     $this->vote2 = null;
     $this->vote3 = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 /**
  * 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
 /**
  * Filter the query by a related \WineTasting\Model\Wine object
  *
  * @param \WineTasting\Model\Wine|ObjectCollection $wine the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildUserQuery The current query, for fluid interface
  */
 public function filterByWineRelatedBySubmitter($wine, $comparison = null)
 {
     if ($wine instanceof \WineTasting\Model\Wine) {
         return $this->addUsingAlias(UserTableMap::COL_IDUSER, $wine->getSubmitter(), $comparison);
     } elseif ($wine instanceof ObjectCollection) {
         return $this->useWineRelatedBySubmitterQuery()->filterByPrimaryKeys($wine->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByWineRelatedBySubmitter() only accepts arguments of type \\WineTasting\\Model\\Wine or Collection');
     }
 }
 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;
 }
Пример #6
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;
 }