本文整理汇总了PHP中Streams::take方法的典型用法代码示例。如果您正苦于以下问题:PHP Streams::take方法的具体用法?PHP Streams::take怎么用?PHP Streams::take使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Streams
的用法示例。
在下文中一共展示了Streams::take方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateAvatar
/**
* Updates the publisher's avatar, as it appears to $toUserId
* This function should be called during events that may cause the
* publisher's avatar to change appearance for certain users viewing it.
* These are usually rare events, and include things like:<br/>
* adding, removing or modifying a contact
* @method updateAvatar
* @static
* @param {integer} $toUserId
* id of the user who will be viewing this avatar
* @param {string} $publisherId
* id of the publisher whose avatar to update
* @return {boolean}
*/
static function updateAvatar($toUserId, $publisherId)
{
$user = new Users_User();
$user->id = $publisherId;
if (!$user->retrieve(null, null, true)->ignoreCache()->resume()) {
return false;
}
// Fetch some streams as the contact user
$streams = Streams::fetch($toUserId, $publisherId, array('Streams/user/firstName', 'Streams/user/lastName'));
$firstName = Streams::take($streams, 'Streams/user/firstName', 'content');
$lastName = Streams::take($streams, 'Streams/user/lastName', 'content');
// Update the Streams_avatar table
Streams_Avatar::update()->set(array('firstName' => $firstName, 'lastName' => $lastName, 'username' => $user->username, 'icon' => $user->icon))->where(array('toUserId' => $toUserId, 'publisherId' => $publisherId))->execute();
return true;
}