/** * 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 you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by find*() * and findPk*() calls. * * @param \ApostaAiApi\Models\Bet $obj A \ApostaAiApi\Models\Bet 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 (null === $key) { $key = serialize([null === $obj->getUserId() || is_scalar($obj->getUserId()) || is_callable([$obj->getUserId(), '__toString']) ? (string) $obj->getUserId() : $obj->getUserId(), null === $obj->getChosenParticipantId() || is_scalar($obj->getChosenParticipantId()) || is_callable([$obj->getChosenParticipantId(), '__toString']) ? (string) $obj->getChosenParticipantId() : $obj->getChosenParticipantId()]); } // if key === null self::$instances[$key] = $obj; } }
/** * Exclude object from result * * @param ChildBet $bet Object to remove from the list of results * * @return $this|ChildBetQuery The current query, for fluid interface */ public function prune($bet = null) { if ($bet) { $this->addCond('pruneCond0', $this->getAliasedColName(BetTableMap::COL_USER_ID), $bet->getUserId(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(BetTableMap::COL_CHOSEN_PARTICIPANT_ID), $bet->getChosenParticipantId(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } return $this; }
/** * Filter the query by a related \ApostaAiApi\Models\Bet object * * @param \ApostaAiApi\Models\Bet|ObjectCollection $bet the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildParticipantQuery The current query, for fluid interface */ public function filterByBet($bet, $comparison = null) { if ($bet instanceof \ApostaAiApi\Models\Bet) { return $this->addUsingAlias(ParticipantTableMap::COL_ID, $bet->getChosenParticipantId(), $comparison); } elseif ($bet instanceof ObjectCollection) { return $this->useBetQuery()->filterByPrimaryKeys($bet->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByBet() only accepts arguments of type \\ApostaAiApi\\Models\\Bet or Collection'); } }