public function getsfPollUserAnswersJoinsfPoll($criteria = null, $con = null) { include_once 'plugins/sfPropelPollsPlugin/lib/model/om/BasesfPollUserAnswerPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collsfPollUserAnswers === null) { if ($this->isNew()) { $this->collsfPollUserAnswers = array(); } else { $criteria->add(sfPollUserAnswerPeer::ANSWER_ID, $this->getId()); $this->collsfPollUserAnswers = sfPollUserAnswerPeer::doSelectJoinsfPoll($criteria, $con); } } else { $criteria->add(sfPollUserAnswerPeer::ANSWER_ID, $this->getId()); if (!isset($this->lastsfPollUserAnswerCriteria) || !$this->lastsfPollUserAnswerCriteria->equals($criteria)) { $this->collsfPollUserAnswers = sfPollUserAnswerPeer::doSelectJoinsfPoll($criteria, $con); } } $this->lastsfPollUserAnswerCriteria = $criteria; return $this->collsfPollUserAnswers; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(sfPollUserAnswerPeer::ID, $pks, Criteria::IN); $objs = sfPollUserAnswerPeer::doSelect($criteria, $con); } return $objs; }
/** * Get the answer provided by an user from its PK or IP address * * @param int $user_id * @param string $ip_address (optional) * @return sfPollUserAnswer or NULL **/ public function getUserAnswer($user_id, $ip_address = NULL) { $c = new Criteria(); if ($ip_address) { $c->add(sfPollUserAnswerPeer::IP_ADDRESS, $ip_address); } else { $c->add(sfPollUserAnswerPeer::USER_ID, $user_id); } $c->add(sfPollUserAnswerPeer::POLL_ID, $this->getId()); return sfPollUserAnswerPeer::doSelectOne($c); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = sfPollUserAnswerPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setPollId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setAnswerId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setUserId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setIpAddress($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setCreatedAt($arr[$keys[5]]); } }