예제 #1
0
 /**
  * Gets the photos this tag applies to
  *
  * @param SwatDBRange $range optional. The database range of photos to
  *                            select.
  *
  * @return PinholePhotoWrapper the set of {@link PinholePhoto} objects that
  *                              this tag applies to.
  *
  * @see PinholeAbstractTag::getPhotoCount()
  */
 public function getPhotos(SwatDBRange $range = null)
 {
     if (!$this->photos_loaded) {
         $sql = 'select * from PinholePhoto';
         $join_clauses = implode(' ', $this->getJoinClauses());
         if ($join_clauses != '') {
             $sql .= ' ' . $join_clauses . ' ';
         }
         $where_clause = $this->getWhereClause();
         if ($where_clause != '') {
             $sql .= ' where ' . $where_clause;
         }
         if ($range !== null) {
             $this->db->setRange($range->getLimit(), $range->getOffset());
         }
         $wrapper = SwatDBClassMap::get('PinholePhotoWrapper');
         $this->photos = SwatDB::query($this->db, $sql, $wrapper);
         $this->photos_loaded = true;
     }
     return $this->photos;
 }