|
|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
namespace BSR\Lib\db;
|
|
|
|
|
use BSR\Lib\Configuration;
|
|
|
|
|
use BSR\Lib\Search\BookSearch;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* User is mapped on the Useraccounts table. Contains user information : id, login, firstName, lastName, displayName.
|
|
|
|
|
@ -103,8 +104,8 @@ class User extends DbMapping
|
|
|
|
|
$result = Connection::execute($sql);
|
|
|
|
|
|
|
|
|
|
$circulations = $result->to_array();
|
|
|
|
|
$books = array_map(function($c) { return $c['NoticeID']; }, $circulations);
|
|
|
|
|
$books = AudioBook::findBy('NoticeID', $books, true);
|
|
|
|
|
$ids = array_map(function($c) { return $c['NoticeID']; }, $circulations);
|
|
|
|
|
$books = BookSearch::GetBooks($ids, 'id');
|
|
|
|
|
|
|
|
|
|
foreach($circulations as $c) {
|
|
|
|
|
$books[$c['NoticeID']]['date'] = $c['CheckOutDate'];
|
|
|
|
|
@ -176,7 +177,7 @@ class User extends DbMapping
|
|
|
|
|
/**
|
|
|
|
|
* Wishes are all the books that this user want to read.
|
|
|
|
|
* @param int $limit
|
|
|
|
|
* @return AudioBook[]
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getWishes($limit = 50)
|
|
|
|
|
{
|
|
|
|
|
@ -189,7 +190,7 @@ class User extends DbMapping
|
|
|
|
|
|
|
|
|
|
$result = Connection::execute($sql);
|
|
|
|
|
$ids = array_map(function($r) { return $r['NoticeID']; }, $result->to_array());
|
|
|
|
|
return AudioBook::findBy('NoticeID', $ids, true);
|
|
|
|
|
return BookSearch::GetBooks($ids, 'id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|