Get a list of a contact's notes

@param int    $id Contact ID
@param string $search
@param int    $start
@param int    $limit
@param string $orderBy
@param string $orderByDir

@return array|mixed
176832
public function getContactNotes($id, $search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC')
    {
        $parameters = array(
            'search'     => $search,
            'start'      => $start,
            'limit'      => $limit,
            'orderBy'    => $orderBy,
            'orderByDir' => $orderByDir,
        );

        $parameters = array_filter($parameters);

        return $this->makeRequest($this->endpoint.'/'.$id.'/notes', $parameters);
    }
1284559
public function findAll($start, $limit, $sortBy, $sortOrder = 'ASC', $params)
    {
        $query = count($params) ? $this->createFilterQuery($params) : new Query();
        $query->setFrom($start);

        // Sort & order
        $fieldName = (isset($sortBy['fieldName'])) ? $sortBy['fieldName'] : null;

        if ($fieldName !== null && $fieldName !== $this->modelIdentifier) {

            if (isset($this->fieldsMapping[$fieldName])) {
                $fieldName = $this->fieldsMapping[$fieldName];
            }
            $query->setSort(array($fieldName => array('order' => strtolower($sortOrder))));
        } else {
            $query->setSort(array(
                $this->modelIdentifier => array('order' => strtolower($sortOrder)),
            ));
        }

        // Custom filter for admin
        if(method_exists($this->admin, 'getExtraFilter')) {
            $query->setFilter($this->admin->getExtraFilter());
        }

        // Limit
        if ($limit === null) {
            $limit = 10000; // set to 0 does not seem to work
        }

        return $this->finder->find($query, $limit);
    }
212305
public function getListById($list_id)
		{
			$form_data = array(
				'list_id' => $list_id
			);
			$xml = $this->call('getlistbyid', $form_data);

			$list = new MailingList;
			$list
				->setListId((int)$xml->list_id)
				->setListName((string)$xml->list_name)
				->setDescription((string)$xml->description)
				->setTemplate((string)$xml->template)
				->setFromAddress((string)$xml->from)
				->setReplyToAddress((string)$xml->reply_to)
				->setBounceAddress((string)$xml->errors_to)
				->setTrackClicks((bool)$xml->track_clicks)
				->setTrackOpens((bool)$xml->track_opens)
				->setFolderId((int)$xml->folder_Id);

			return $list;
		}
647838
public function findInSection($id, $limit = null, $offset = 0, $all = false)
    {
        $q = $this->createSelectQuery();
        $q->where($q->expr->eq('section', $q->bindValue($id, null, PDO::PARAM_STR)));
        $q->orderBy('position');
        return $this->loadFromQuery($q, $limit, $offset);
    }
907663
public function search(Search $entity, $limit, $offset, $sort_column, $sort_direction)
    {
        $selector = $this->selector
            ->create()
            ->addCountry($entity)
            ->addDateAdd($entity)
            ->addDateEnd($entity)
            ->addDatePremiere($entity)
            ->addGenres($entity)
            ->addLabels($entity)
            ->addName($entity)
            ->addStorage($entity)
            ->addStudio($entity)
            ->addType($entity)
            ->sort($sort_column, $sort_direction)
            ->limit($limit)
            ->offset($offset);

        return [
            'list' => $selector
                ->getQuerySelect()
                ->getQuery()
                ->getResult(),
            'total' => $selector
                ->getQueryTotal()
                ->getQuery()
                ->getSingleScalarResult(),
        ];
    }
748447
public function show($id)
    {
        $ret = $this->get('/relations/'.urlencode($id).'.json');
        if (null === $ret) {
            return [];
        }

        return $ret['relation'];
    }
1168909
public function search(string $query, $limit = 30, $start = 0, $sort = null)
    {
        if ($query == '*.*' && $limit == 30 && $start == 0 && $sort == 'lastupdated desc') {
            $result = $this->fetchFromCache();

            if (null === $result) {
                $result = $this->search->search($query, $limit, $start, $sort);
                $this->saveToCache($result);
            }

            return $result;
        } else {
            return $this->search->search($query, $limit, $start, $sort);
        }
    }
855327
public function list(int $beginId = 0, int $limit = 50, string $status = 'CHECKING')
    {
        $params = [
            'begin_id' => $beginId,
            'limit' => $limit,
            'status' => $status,
        ];

        return $this->httpPostJson('card/submerchant/batchget', $params);
    }
52696
public function index($id = null)
    {
        $this->authorize('readList', Content::class);
        $input  = $this->validator->validate('list');
        $params = $this->processor->process($input)->getProcessedFields();
        if ($id) { // content/id/children
            $content = $this->repository->getById($id);
            if (!empty($content)) {
                $results = $this->repository->getChildren(
                    $content,
                    $params['filter'],
                    $params['orderBy'],
                    $params['page'],
                    $params['perPage']
                );
                return $this->respondWithSuccess($results, new ContentTransformer);
            } else {
                return $this->respondNotFound();
            }
        }

        $results = $this->repository->getContents(
            $params['filter'],
            $params['orderBy'],
            $params['page'],
            $params['perPage']
        );

        return $this->respondWithSuccess($results, new ContentTransformer);
    }
1276881
public function getCustomList(QueryBuilder $queryBuilder, $start = 0, $limit = 0)
    {
        $parameters = array(
            'select' => $queryBuilder->getSelect(),
            'where'  => $queryBuilder->getWhere(),
            'order'  => $queryBuilder->getOrder(),
            'start'  => $start,
            'limit'  => $limit,
        );

        $parameters = array_filter($parameters);

        $supported = $this->isSupported('getList');

        return (true === $supported) ? $this->makeRequest($this->endpoint, $parameters) : $supported;
    }
1294749
public function getParents($id, $ordering = 'ASC')
    {
        if ($parents = $this->qb
            ->select($this->table . '.*')
            ->from($this->table)
            ->from($this->table . ' AS node')
            ->whereBetween('node.record_left', [$this->table . '.record_left', $this->table . '.record_right'])
            ->where([
                'node.id' => $id,
            ])
            ->orderBy($this->table . '.record_left', $ordering)
            ->get()) {
            if ($parents->count()) {
                return $parents;
            }
        }

        return false;
    }
316395
public function getContacts($limit = NULL, $offset = NULL) {
    $parameters = array();
    if (!empty($limit)) {
      $parameters['limit'] = $limit;
      if (!empty($offset)) {
        $parameters['offset'] = $offset;
      }
    }
    $data = $this->request('GET', 'contacts', $parameters);
    return $data->contacts;
  }
1245185
public function getAction($id, Request $request)
    {
        if ($this->getBooleanRequestParameter($request, 'tree', false, false)) {
            $collections = $this->getCollectionManager()->getTreeById(
                $id,
                $this->getRequestParameter($request, 'locale', true)
            );

            return $this->handleView(
                $this->view(
                    new CollectionRepresentation($collections, 'collections')
                )
            );
        }

        try {
            $locale = $this->getRequestParameter($request, 'locale', true);
            $depth = intval($request->get('depth', 0));
            $breadcrumb = $this->getBooleanRequestParameter($request, 'breadcrumb', false, false);
            $children = $this->getBooleanRequestParameter($request, 'children', false, false);
            $collectionManager = $this->getCollectionManager();

            // filter children
            $listRestHelper = $this->get('sulu_core.list_rest_helper');
            $limit = $request->get('limit', null);
            $offset = $this->getOffset($request, $limit);
            $search = $listRestHelper->getSearchPattern();
            $sortBy = $request->get('sortBy');
            $sortOrder = $request->get('sortOrder', 'ASC');

            $filter = [
                'limit' => $limit,
                'offset' => $offset,
                'search' => $search,
            ];

            $view = $this->responseGetById(
                $id,
                function($id) use ($locale, $collectionManager, $depth, $breadcrumb, $filter, $sortBy, $sortOrder, $children) {
                    $collection = $collectionManager->getById(
                        $id,
                        $locale,
                        $depth,
                        $breadcrumb,
                        $filter,
                        null !== $sortBy ? [$sortBy => $sortOrder] : [],
                        $children
                    );

                    if (SystemCollectionManagerInterface::COLLECTION_TYPE === $collection->getType()->getKey()) {
                        $this->get('sulu_security.security_checker')->checkPermission(
                            'sulu.media.system_collections',
                            PermissionTypes::VIEW
                        );
                    }

                    return $collection;
                }
            );
        } catch (CollectionNotFoundException $cnf) {
            $view = $this->view($cnf->toArray(), 404);
        } catch (MediaException $e) {
            $view = $this->view($e->toArray(), 400);
        }

        return $this->handleView($view);
    }
1267320
public function resolveContactFunction($id)
    {
        if ($this->cache->contains($id)) {
            return $this->cache->fetch($id);
        }

        $contact = $this->contactRepository->find($id);
        if (null === $contact) {
            return;
        }

        $this->cache->save($id, $contact);

        return $contact;
    }
1012141
public function getList($limit, $offset = 0)
    {
        return $this->getEntityManager()->createQuery('
            SELECT
                n
            FROM
                AnimeDbAppBundle:Notice n
            ORDER BY
                n.date_created DESC
        ')
            ->setFirstResult($offset)
            ->setMaxResults($limit)
            ->getResult();
    }
473902
public function findByLocation(Location $location, array $orderBy = [],
        ?int $limit = null): array
    {
        $qb = $this->createQueryBuilder('su');
        $this->filterByLocation($qb, $location);
        $this->addOrderBy($qb, $orderBy);
        $this->addLimit($qb, $limit);

        return $qb->getQuery()->getResult();
    }
1032863
public function getContactsAction($id, Request $request)
    {
        if ('true' == $request->get('flat')) {
            /* @var AccountInterface $account */
            $account = $this->getRepository()->findById($id);

            /** @var RestHelperInterface $restHelper */
            $restHelper = $this->getRestHelper();

            /** @var DoctrineListBuilderFactory $factory */
            $factory = $this->get('sulu_core.doctrine_list_builder_factory');

            $listBuilder = $factory->create(self::$accountContactEntityName);

            $fieldDescriptors = $this->getAccountContactFieldDescriptors();
            $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

            $listBuilder->addSelectField($fieldDescriptors['contactId']);
            $listBuilder->setIdField($fieldDescriptors['id']);
            $listBuilder->where($fieldDescriptors['account'], $id);
            $listBuilder->sort($fieldDescriptors['lastName'], $listBuilder::SORTORDER_ASC);

            $values = $listBuilder->execute();

            foreach ($values as &$value) {
                // Substitute id since we are interested in the contact id not the accountContact id.
                $value['id'] = $value['contactId'];
                unset($value['contactId']);

                if (null != $account->getMainContact() && $value['id'] === $account->getMainContact()->getId()) {
                    $value['isMainContact'] = true;
                } else {
                    $value['isMainContact'] = false;
                }
            }

            $list = new ListRepresentation(
                $values,
                'contacts',
                'get_account_contacts',
                array_merge(['id' => $id], $request->query->all()),
                $listBuilder->getCurrentPage(),
                $listBuilder->getLimit(),
                $listBuilder->count()
            );
        } else {
            $contactManager = $this->getAccountManager();
            $locale = $this->getUser()->getLocale();
            $contacts = $contactManager->findContactsByAccountId($id, $locale, false);
            $list = new CollectionRepresentation($contacts, self::$contactEntityKey);
        }
        $view = $this->view($list, 200);

        return $this->handleView($view);
    }