/** * Gets an array of CourseCommentDig 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 CourseComment has previously been saved, it will retrieve * related CourseCommentDigs from storage. If this CourseComment 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 CourseCommentDig[] * @throws PropelException */ public function getCourseCommentDigs($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(CourseCommentPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collCourseCommentDigs === null) { if ($this->isNew()) { $this->collCourseCommentDigs = array(); } else { $criteria->add(CourseCommentDigPeer::COMMENT_ID, $this->id); CourseCommentDigPeer::addSelectColumns($criteria); $this->collCourseCommentDigs = CourseCommentDigPeer::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(CourseCommentDigPeer::COMMENT_ID, $this->id); CourseCommentDigPeer::addSelectColumns($criteria); if (!isset($this->lastCourseCommentDigCriteria) || !$this->lastCourseCommentDigCriteria->equals($criteria)) { $this->collCourseCommentDigs = CourseCommentDigPeer::doSelect($criteria, $con); } } } $this->lastCourseCommentDigCriteria = $criteria; return $this->collCourseCommentDigs; }
/** * Retrieve object using using composite pkey values. * @param string $ip @param int $comment_id * @param PropelPDO $con * @return CourseCommentDig */ public static function retrieveByPK($ip, $comment_id, PropelPDO $con = null) { $key = serialize(array((string) $ip, (string) $comment_id)); if (null !== ($obj = CourseCommentDigPeer::getInstanceFromPool($key))) { return $obj; } if ($con === null) { $con = Propel::getConnection(CourseCommentDigPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(CourseCommentDigPeer::DATABASE_NAME); $criteria->add(CourseCommentDigPeer::IP, $ip); $criteria->add(CourseCommentDigPeer::COMMENT_ID, $comment_id); $v = CourseCommentDigPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }