/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(flickrTokenPeer::DATABASE_NAME); $criteria->add(flickrTokenPeer::KALT_TOKEN, $pks, Criteria::IN); $objs = flickrTokenPeer::doSelect($criteria, $con); } return $objs; }
/** * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless * of whether or not they have been modified. * * @return Criteria The Criteria object containing value(s) for primary key(s). */ public function buildPkeyCriteria() { $criteria = new Criteria(flickrTokenPeer::DATABASE_NAME); $criteria->add(flickrTokenPeer::KALT_TOKEN, $this->kalt_token); if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(flickrTokenPeer::UPDATED_AT)) { $theModifiedColumn = null; foreach ($this->modifiedColumns as $modifiedColumn) { if ($modifiedColumn != flickrTokenPeer::UPDATED_AT) { $theModifiedColumn = $modifiedColumn; } } $atomicColumns = flickrTokenPeer::getAtomicColumns(); if (in_array($theModifiedColumn, $atomicColumns)) { $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL); } } return $criteria; }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = flickrTokenPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setKaltToken($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setFrob($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setToken($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setNsid($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setResponse($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setIsValid($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setCreatedAt($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setUpdatedAt($arr[$keys[7]]); } }
private static function searchImages($searchText, $page, $pageSize, $authData = null) { $params = array('method' => 'flickr.photos.search', 'page' => $page, 'per_page' => $pageSize, 'text' => $searchText); if ($authData) { $flickrToken = flickrTokenPeer::retrieveByPK($authData); if ($flickrToken) { $params['user_id'] = 'me'; $params['auth_token'] = $flickrToken->getToken(); } } else { $params['license'] = '4'; } $images = array(); $message = ''; $rsp_obj = self::sendRequest($params); if ($rsp_obj['stat'] == 'ok') { $photo = $rsp_obj['photos']['photo']; foreach ($photo as $key => $value) { $thumb = 'http://farm' . $value['farm'] . '.static.flickr.com/' . $value['server'] . '/' . $value['id'] . '_' . $value['secret'] . '_t.jpg'; $title = $value['title']; $images[] = array('thumb' => $thumb, 'title' => $title, 'id' => $value['id'] . ':' . $value['secret']); //echo $title."\n".$url."\n"; } $status = 'ok'; } else { //print_r($rsp_obj); $status = 'error'; $message = $rsp_obj['code'] . ' : ' . $rsp_obj['message']; } return array('status' => $status, 'message' => $message, 'objects' => $images, "needMediaInfo" => self::$NEED_MEDIA_INFO); }