/**
  * Retrieve object using using composite pkey values.
  * @param      int $user_id
  * @param      int $test_id
  * @param      int $variant_id
  * @param      PropelPDO $con
  * @return     PcSplitTestUserResult
  */
 public static function retrieveByPK($user_id, $test_id, $variant_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $user_id, (string) $test_id, (string) $variant_id));
     if (null !== ($obj = PcSplitTestUserResultPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(PcSplitTestUserResultPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(PcSplitTestUserResultPeer::DATABASE_NAME);
     $criteria->add(PcSplitTestUserResultPeer::USER_ID, $user_id);
     $criteria->add(PcSplitTestUserResultPeer::TEST_ID, $test_id);
     $criteria->add(PcSplitTestUserResultPeer::VARIANT_ID, $variant_id);
     $v = PcSplitTestUserResultPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
예제 #2
0
 /**
  * Gets an array of PcSplitTestUserResult objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this PcSplitTest has previously been saved, it will retrieve
  * related PcSplitTestUserResults from storage. If this PcSplitTest is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array PcSplitTestUserResult[]
  * @throws     PropelException
  */
 public function getPcSplitTestUserResults($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(PcSplitTestPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPcSplitTestUserResults === null) {
         if ($this->isNew()) {
             $this->collPcSplitTestUserResults = array();
         } else {
             $criteria->add(PcSplitTestUserResultPeer::TEST_ID, $this->id);
             PcSplitTestUserResultPeer::addSelectColumns($criteria);
             $this->collPcSplitTestUserResults = PcSplitTestUserResultPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(PcSplitTestUserResultPeer::TEST_ID, $this->id);
             PcSplitTestUserResultPeer::addSelectColumns($criteria);
             if (!isset($this->lastPcSplitTestUserResultCriteria) || !$this->lastPcSplitTestUserResultCriteria->equals($criteria)) {
                 $this->collPcSplitTestUserResults = PcSplitTestUserResultPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPcSplitTestUserResultCriteria = $criteria;
     return $this->collPcSplitTestUserResults;
 }