- $user = new User();
- $user->limit($limit);
- $user->whereAdd('nickname like \'' . trim($user->escape($term), '\'') . '%\'');
- if($user->find()){
- while($user->fetch()) {
- $this->users[]=clone($user);
+ $profile = new Profile();
+ $profile->limit($limit);
+ $profile->whereAdd('nickname like \'' . trim($profile->escape($term), '\'') . '%\'');
+ $profile->whereAdd(sprintf('id in (SELECT id FROM user) OR '
+ . 'id in (SELECT subscribed from subscription'
+ . ' where subscriber = %d)', $cur->id));
+ if ($profile->find()) {
+ while($profile->fetch()) {
+ $this->profiles[]=clone($profile);