Returns a single analytics by id.

@param string $webspace
@param int $id

@return Response
19592
public function getAction($webspace, $id)
    {
        $entity = $this->get('sulu_website.analytics.manager')->find($id);

        return $this->handleView($this->view($entity, 200));
    }
20186
public function indexByUser($id)
    {
        $user = \App\User::find($id);

        if (!$user) {
            return response()->json(null, 404);
        }

        $roles = Role::browseByUser([
            'order'     => [ Input::get('sort', 'name') => Input::get('direction', 'asc') ],
            'limit'     => ($limit = (int)Input::get('limit', 25)),
            'offset'    => (Input::get('page', 1) - 1) * $limit,
            'user'      => $user
        ]);

        return response()->json(arrayView('phpsoft.users::role/browse', [
            'roles' => $roles,
        ]), 200);
    }
108655
public function cgetAction($webspace, Request $request)
    {
        // TODO pagination

        $result = $this->get('sulu_custom_urls.manager')->findList($webspace);

        $list = new RouteAwareRepresentation(
            new CollectionRepresentation($result, self::$relationName),
            'cget_webspace_custom-urls',
            array_merge($request->request->all(), ['webspace' => $webspace])
        );

        return $this->handleView($this->view($list));
    }
1325397
public function fetchById($id)
    {
        $data = $this->getProvider()->fetchById($id);
        return $this->resultAsModel($data);
    }
168754
public function putAction(Request $request, $webspace, $id)
    {
        $data = $request->request->all();
        $data['content'] = $this->buildContent($data);

        $entity = $this->get('sulu_website.analytics.manager')->update($id, $data);
        $this->get('doctrine.orm.entity_manager')->flush();
        $this->get('sulu_website.http_cache.clearer')->clear();

        return $this->handleView($this->view($entity, 200));
    }
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);
    }
560488
public function find($id = null, $params = [])
    {
        if (!$id) {
            throw new InvalidArgumentException('We need an id');
        }

        return $this->gateway->commit('get', $this->gateway->buildUrlFromString('notifications/webhooks/'.$id), [], $params);
    }
348917
public function get($id)
    {
        //ACCESS CHECK
        if (!$this->isAllowed(ResourceName::RESOURCE_SITES, 'admin')) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        // get default site data - kinda hacky, but keeps us to one controller
        if ($id == 'default') {
            $siteManager = $this->getSiteManager();

            $data = $siteManager->getDefaultSiteValues();

            $site = new Site(
                $this->getCurrentUserId(),
                'Get default site values in ' . get_class($this)
            );

            $site->populate($data);

            return new ApiJsonModel($site, 0, 'Success');
        }

        // get current site data - kinda hacky, but keeps us to one controller
        if ($id == 'current') {
            $site = $this->getCurrentSite();

            return new ApiJsonModel($site, 0, 'Success');
        }

        /** @var \Rcm\Repository\Site $siteRepo */
        $siteRepo = $this->getEntityManager()->getRepository(
            \Rcm\Entity\Site::class
        );

        try {
            $site = $siteRepo->find($id);
        } catch (\Exception $e) {
            return new ApiJsonModel(
                null,
                1,
                "Failed to find site by id ({$id})"
            );
        }
        /* ADDED THIS CHECK TO GET RID OF ERROR. */
        /* NOT SURE WHY TRY CATCH ABOVE ISN'T WORKING */

        if ($site instanceof Site) {
            return new ApiJsonModel($site, 0, 'Success');
        } else {
            return new ApiJsonModel(null, 1, "Failed to find site by id ({$id})");
        }
    }
1171430
public function traceAction($token, $id)
    {
        $this->profiler->disable();
        $profile = $this->profiler->loadProfile($token);
        $queries = $profile->getCollector('doctrine_profiler')->getQueries();

        if (!isset($queries[$id])) {
            return new Response('This query does not exist.');
        }

        $query = $queries[$id];
        $source = 0;
        foreach ($query['trace'] as $i => $trace) {
            if (isset($trace['query_source'])) {
                $source = $i;
            }
        }

        return $this->templating->renderResponse('PixersDoctrineProfilerBundle:Collector:trace.html.twig', array(
            'source' => $source,
            'traces' => $query['trace'],
            'id' => $id,
            'prefix' => $id,
        ));
    }
887453
public function show($id)
    {
        $webhook = $this->client->get(
            sprintf('buckets/%d/webhooks/%d.json', $this->bucket, $id)
        );
        $webhook = new Webhook($this->response($webhook));
        $webhook->inContext($this->bucket);

        return $webhook;
    }
571923
public function getQuestion4Id($id)
    {
        $query = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.id = :id')
            ->setParameter('id', $id)
            ->getQuery();


        return $query->getOneOrNullResult();
    }
1213219
public function getAction($id)
    {
        $view = $this->responseGetById(
            $id,
            function($id) {
                return $this->getDoctrine()
                    ->getRepository(self::$entityName)
                    ->find($id);
            }
        );

        return $this->handleView($view);
    }
1269688
public function pageview($id, $url, $referrer = '')
    {
        $body = array_merge( array('name' => $url, 'type' => 'page'), $this->parseData( array( 'referrer' => $referrer ) ) );

        try {
            $response = $this->client->post('/api/v1/customers/'.$id.'/events', array(
                'auth' => $this->auth,
                'json' => $body,
            ));
        } catch (BadResponseException $e) {
            $response = $e->getResponse();
        } catch (RequestException $e) {
            return new Response($e->getCode(), $e->getMessage());
        }

        return new Response($response->getStatusCode(), $response->getReasonPhrase());
    }
1005129
public function in($id, array $ids)
    {
        $url = $this->buildUrlByMethodName(
            'getInUrl',
            [
                'id' => $id,
                'ids' => implode(',', $ids),
            ]
        );

        $response = $this->resolveApiUrl($url);

        return $response['result'];
    }
1291795
public function getDMById($id)
    {
        return $this->getDMs()->then(function (array $dms) use ($id) {
            foreach ($dms as $dm) {
                if ($dm->getId() === $id) {
                    return $dm;
                }
            }

            throw new ApiException('DM ' . $id . ' not found.');
        });
    }
136872
public function fetchById($id)
    {
        $data = $this->getRequest()->getContents($this->getKey(), $id);
        return $data;
    }
1317797
public function findById($id)
    {
        Assertion::integer($id);

        $crawler = $this->client->request('GET', sprintf(self::URL_SUBJECTS, $id));
        $detailUrl = $this->extractDetailUrlFromCrawler($crawler);

        if (false === $detailUrl) {
            return false;
        }

        $people = [];

        $crawler = $this->client->request('GET', $detailUrl);
        $crawler->filter('.aunp-content .div-table')->each(function (Crawler $table) use (&$people) {
            $title = $table->filter('.vr-hlavicka')->text();

            try {
                if ('jednatel: ' === $title) {
                    $person = JusticeJednatelPersonParser::parseFromDomCrawler($table);
                    $people[$person->getName()] = $person;
                } elseif ('Společník: ' === $title) {
                    $person = JusticeSpolecnikPersonParser::parseFromDomCrawler($table);
                    $people[$person->getName()] = $person;
                }
            } catch (\Exception $e) {
                throw $e;
            }
        });

        return new JusticeRecord($people);
    }