コード例 #1
0
 /**
  * Gets an array of PcSplitTestResult 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 PcSplitTestResults 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 PcSplitTestResult[]
  * @throws     PropelException
  */
 public function getPcSplitTestResults($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(PcSplitTestPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPcSplitTestResults === null) {
         if ($this->isNew()) {
             $this->collPcSplitTestResults = array();
         } else {
             $criteria->add(PcSplitTestResultPeer::TEST_ID, $this->id);
             PcSplitTestResultPeer::addSelectColumns($criteria);
             $this->collPcSplitTestResults = PcSplitTestResultPeer::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(PcSplitTestResultPeer::TEST_ID, $this->id);
             PcSplitTestResultPeer::addSelectColumns($criteria);
             if (!isset($this->lastPcSplitTestResultCriteria) || !$this->lastPcSplitTestResultCriteria->equals($criteria)) {
                 $this->collPcSplitTestResults = PcSplitTestResultPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPcSplitTestResultCriteria = $criteria;
     return $this->collPcSplitTestResults;
 }
コード例 #2
0
 /**
  * Retrieve object using using composite pkey values.
  * @param      int $test_id
  * @param      int $variant_id
  * @param      PropelPDO $con
  * @return     PcSplitTestResult
  */
 public static function retrieveByPK($test_id, $variant_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $test_id, (string) $variant_id));
     if (null !== ($obj = PcSplitTestResultPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(PcSplitTestResultPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(PcSplitTestResultPeer::DATABASE_NAME);
     $criteria->add(PcSplitTestResultPeer::TEST_ID, $test_id);
     $criteria->add(PcSplitTestResultPeer::VARIANT_ID, $variant_id);
     $v = PcSplitTestResultPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }