|
|
|
Prototype declarations are there:
class UserSearchDocument extends SearchDocument {
(1) public function __construct(&$userhash, $user_id, $context_id) {
class UserPostSearchDocument extends SearchDocument {
(2) public function __construct(&$post, $user_id, $context_id) {
In function user_single_document(), these constructors are called as follows:
(1) return new UserSearchDocument($userhash, $user->id, 'user', null);
(2) return new UserPostSearchDocument($posthash, $post->userid, 'post', null);
To match call with prototype, we need to change as follows:
(1) return new UserSearchDocument($userhash, $user->id, null);
(2) return new UserPostSearchDocument($posthash, $post->userid, null);
------------------
Original code about (2) was,
(2) return new UserPostSearchDocument($posthash, $user->id, 'post', null);
but we also need to change $user->id to $post->id, since we does not know userid directly from $user->id when itemtype equals 'post'.
|
|
Description
|
Prototype declarations are there:
class UserSearchDocument extends SearchDocument {
(1) public function __construct(&$userhash, $user_id, $context_id) {
class UserPostSearchDocument extends SearchDocument {
(2) public function __construct(&$post, $user_id, $context_id) {
In function user_single_document(), these constructors are called as follows:
(1) return new UserSearchDocument($userhash, $user->id, 'user', null);
(2) return new UserPostSearchDocument($posthash, $post->userid, 'post', null);
To match call with prototype, we need to change as follows:
(1) return new UserSearchDocument($userhash, $user->id, null);
(2) return new UserPostSearchDocument($posthash, $post->userid, null);
------------------
Original code about (2) was,
(2) return new UserPostSearchDocument($posthash, $user->id, 'post', null);
but we also need to change $user->id to $post->id, since we does not know userid directly from $user->id when itemtype equals 'post'.
|
Show » |
| There are no comments yet on this issue.
|
|