Get a collection of favourite Accounts for User

@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since  0.10.0

@return Collection
438232
public function getFavouriteAccountsForUser(UserInterface $user)
    {
        $criteria = new Criteria();
        $criteria
            ->where($criteria->expr()->in(
                'id',
                $user->getMyFavouriteAccountIds()
            ))
        ;

        return $this->oh->getOrganization()
            ->getAccounts()
            ->matching($criteria)
        ;
    }
858468
public function getAccount()
    {
        $response = $this->rest->get(
            static::ACCOUNT_PATH
        );

        $this->checkResponse($response);

        return new Account($response);
    }
1300571
protected function getListCollection()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        return (array) $this->collection->getList($conditions);
    }
675269
public function getGuildsAttribute()
    {
        $response = $this->discord->request(
            'GET',
            $this->discord->getGuildsEndpoint(),
            $this->token
        );

        $collection = new Collection();

        foreach ($response as $raw) {
            $collection->push(
                $this->discord->buildPart(Guild::class, $this->token, $raw)
            );
        }

        return $collection;
    }
742086
private function getResourceAccount()
    {
        if (!$this->account) {
            $payload = [
                'onlyReturnExisting' => true,
            ];

            $this->requestResource('POST', ResourcesDirectory::NEW_ACCOUNT, $payload);
            $this->account = $this->getHttpClient()->getLastLocation();
        }

        return $this->account;
    }
93658
public function actionCollection()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $source = $this->findModel(Yii::$app->request->post('model_id'));
        if (($collect = ArticleCollection::find()->where(['model_id' => $source->id, 'user_id' => Yii::$app->user->getId()])->one()) != null) {
            $collect->delete();
            return ['status' => 'unCollect'];
        } else {
            $model = new ArticleCollection();
            $model->subject = $source->title;
            $model->model_id = $source->id;
            $model->load(Yii::$app->request->post(), '');
            if ($model->save() === false && !$model->hasErrors()) {
                throw new ServerErrorHttpException('Failed to update the object for unknown reason.');
            }
            return ['status' => 'collected'];
        }
    }
366256
public function user($user = 0)
    {
        if (! $this->user->has($user)) {
            $data = new Collection([]);

            $this->user->put($user, $data);
        }

        return $this->user->get($user);
    }
534864
public function getFavorites(): UserFavoritesData
    {
        $json = $this->client->performApiCallWithJsonResponse('get', '/user/favorites');
        return ResponseHandler::create($json, ResponseHandler::METHOD_USER_FAVORITES)->handle();
    }
20634
public function users()
    {
        return $this->belongsToMany(Config::get('auth.providers.users.model'), Config::get('entrust.role_user_table'), Config::get('entrust.role_foreign_key'), Config::get('entrust.user_foreign_key'));
        // return $this->belongsToMany(Config::get('auth.model'), Config::get('entrust.role_user_table'));
    }
621994
public function favoriters()
    {
        return $this->morphToMany(config('follow.user_model'), config('follow.morph_prefix'), config('follow.followable_table'))
                    ->wherePivot('relation', '=', Follow::RELATION_FAVORITE)
                    ->withPivot('followable_type', 'relation', 'created_at');
    }
140271
public function getAccounts()
    {
        $accounts = [];
        $groups   = $this->rpc->query("listAccounts", [0]);
        foreach($groups as $account => $balance) {
            $accounts[] = $account;
        }
        
        return $accounts;
    }
1184072
public static function getFavouriteComponentIds($favouritesModel)
    {
        $ret = array();
        $userId = Kwf_Registry::get('userModel')->getAuthedUserId();
        if ($userId) {
            $cacheIdUser = 'favCIds'.$userId;
            $ret = Kwf_Cache_Simple::fetch($cacheIdUser, $success);
            if (!$success) {
                // get all favourites related to user
                $select = new Kwf_Model_Select();
                $select->whereEquals('user_id', $userId);
                $favouritesModel = Kwf_Model_Abstract::getInstance($favouritesModel);
                $favourites = $favouritesModel->getRows($select);
                $componentIds = array();
                foreach ($favourites as $favourite) {
                    $component = Kwf_Component_Data_Root::getInstance()
                        ->getComponentById($favourite->component_id);
                    // check if component is visible and existent
                    if ($component) {
                        // if component is visible create list of users related to component
                        $componentIds[] = $component->componentId;
                    }
                }
                // cache relation of visible components to user
                Kwf_Cache_Simple::add($cacheIdUser, $componentIds);
                $ret = $componentIds;
            }
        }
        return $ret;
    }
106773
protected function getPermissions()
    {
        try {
            return $this->cache->rememberForever('permissions.policies', function () {
                return Permission::with('roles')->get();
            });
        } catch (\Exception $exception) {
            $this->cache->forget('permissions.policies');

            return new Collection;
        }
    }
862687
public function getFans()
    {
        if ($this->_fans === false) {
            $this->_fans = Fans::findByOpenId($this->message['FromUserName']);
        }
        return $this->_fans;
    }
568267
public static function get(
    ): Collection {
        $googleTaskLists = static::getGoogleTaskLists();
        $googleLists = $googleTaskLists->listTaskLists();

        return collect($googleLists)
            ->map(function (Google_Service_Tasks_TaskList $tasklist) {
                return TaskLists::createFromGoogleTaskLists($tasklist);
            })
            ->sortBy(function (TaskLists $tasklist) {
                return $tasklist->title;
            })
            ->values();
    }
419102
public function getGroupsAccounts()
  {
    //Is Group: Further accounts can be made under Groups, but entries can be made against non-Groups
    $accounts = array();

    $this->Account->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($Account) use (&$accounts)
    {
      if($Account->is_group)
      {
        array_push($accounts, array('label'=> $Account->key . ' ' . $Account->name, 'value'=>$Account->id));
      }
    });

    return $accounts;
  }
1053981
public function getAccounts()
    {
        $dialog = $this->getDialog();
        $result = $dialog->syncDialog();
        $this->bankName = $dialog->getBankName();
        $accounts = new GetAccounts($result);

        return $accounts->getAccountsArray();
    }