Returns all Locations with CTA data within a Campaign.

@ApiDoc(
section = "Core",
views = { "private" },
requirements={
{
"name"="id",
"requirement"="\d+"
}
}
)

@param $id Campaign ID
@return Response
188063
public function apiListCtaLocationsPerCampaignAction($id)
    {
        $repository = $this->getDoctrine()
            ->getRepository('CampaignChainCoreBundle:ReportCTA');
        $qb = $repository->createQueryBuilder('r');
        $qb->select('r')
            ->where('r.campaign = :campaignId')
            ->andWhere('r.sourceLocation = r.targetLocation')
            ->andWhere('r.targetLocation IS NOT NULL')
            ->groupBy('r.sourceLocation')
            ->orderBy('r.sourceName', 'ASC')
            ->setParameter('campaignId', $id);
        $query = $qb->getQuery();
        $locations = $query->getResult();

        $response = array();
        foreach ($locations as $location) {
            $response[] = [
                'id' => $location->getTargetLocation()->getId(),
                'display_name' => $location->getTargetName()
                    .' ('.$location->getTargetUrl().')',
            ];
        }

        $serializer = $this->get('campaignchain.core.serializer.default');

        return new Response($serializer->serialize($response, 'json'));
    }
156721
public function load($id)
    {

        // if not, try to load the customer with the passed entity ID
        $this->customerAddressStmt->execute(array(MemberNames::ENTITY_ID => $id));
        return $this->customerAddressStmt->fetch(\PDO::FETCH_ASSOC);
    }
111258
function _get_plan_by_id( $id ) {
            $this->_logger->entrance();

            if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
                $this->_sync_plans();
            }

            foreach ( $this->_plans as $plan ) {
                if ( $id == $plan->id ) {
                    return $plan;
                }
            }

            return false;
        }
566442
public function getSnapshots($id)
    {
        $snapshots = $this->adapter->get(sprintf('%s/droplets/%d/snapshots?per_page=%d', $this->endpoint, $id, 200));

        $snapshots = json_decode($snapshots);

        $this->meta = $this->extractMeta($snapshots);

        return array_map(function ($snapshot) {
            $snapshot = new ImageEntity($snapshot);

            return $snapshot;
        }, $snapshots->snapshots);
    }
551457
public function getSchoolsByLocation($id) {
    $schools = [];

    $cid = __METHOD__ . $id;
    if ($cache = $this->cache->get($cid)) {
      return $cache->data;
    }

    $programs = $this->getChildCareProgramsByLocation($id);
    foreach ($programs as $program) {
      $schools_data = $this->getSchoolsByChildCareProgramId($program);
      foreach ($schools_data as $school) {
        $schools[$school['id']] = $school['name'];
      }
    }

    $this->cache->set($cid, $schools);
    return $schools;
  }
966372
public function get($id = null)
    {
        if (!is_null($id)) {
            if (isset($this->sections[$id])) {
                return $this->sections[$id];
            }
            return;

        }
        return $this->sections;
    }
78001
public function campaignStatByCountries($id)
    {
        if (empty($id)) {
            return $this->handleError('Empty campaign id');
        }

        $requestResult = $this->sendRequest('campaigns/' . $id . '/countries');

        return $this->handleResult($requestResult);
    }
1018024
public function getCredentials($id)
    {
        return $this->createCommand()
            ->setRequest($this->client->get('credentials/' . $id))
            ->setResponseClass('Maba\OAuthCommerceInternalClient\Entity\ClientCredentials')
        ;
    }
832754
public function listGistsCommits(string $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/gists/:id/commits', $id));
    }
132009
public function get($id)
    {
        $response = $this->mailjet->get(Resources::$Template, ['id' => $id]);
        if (!$response->success()) {
            $this->throwError("TemplateService:get() failed", $response);
        }

        return $response->getData();
    }
697304
public function detailWithAddresses($id)
    {
        $dealer = $this->detail($id);

        if ($dealer->dealersToAddresses) {
            $addressesId = array_map(function($value) {
                return $value['addressId'];
            }, $dealer->dealersToAddresses);

            $addresses = $this->client->addresses()
                ->ids(array_values($addressesId))
                ->all();

            $dealer->addresses = $addresses;
        }

        return $dealer;
    }
1051042
public function getSubs($id)
	{
		$target = Member::find($id);

		$department_ids = $this->getSubDepartments($target->department);
		$position_ids = $this->getSubPositions($target->position);
		
		$recs = Member::whereIn('department', $department_ids)
		              ->whereIn('position', $position_ids)
		              ->where('id', '>', 1)
		              ->where('state', 0)
              		  ->where('new', 1)
		              ->where('private', 1)
		              ->where('show', 0)
		              ->get();

		$arr = [];             
		if(count($recs)){
			foreach ($recs as $rec) {
				$arr[] = $rec->work_id;
			}
			return $arr;
		}

	}
716453
public function getReport($id = null)
    {
        if ($id === null) {
            $id = $this->id;
        }

        return array('runId' => $id, 'report' => sprintf('%s?run=%s&source=%s', $this->host, $id, $this->namespace));
    }
571923
public function getQuestion4Id($id)
    {
        $query = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.id = :id')
            ->setParameter('id', $id)
            ->getQuery();


        return $query->getOneOrNullResult();
    }
861248
public function getSinglePublicKey(int $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/user/keys/:id', (string)$id));
    }
729360
public function getCampaignEditForm($id)
    {
        // Get record-specific fields
        $record = ChangeSet::get()->byID($id);
        if (!$record) {
            $this->httpError(404);
            return null;
        }
        if (!$record->canView()) {
            $this->httpError(403);
            return null;
        }

        $fields = $record->getCMSFields();

        // Add standard fields
        $fields->push(HiddenField::create('ID'));
        $form = Form::create(
            $this,
            'campaignEditForm',
            $fields,
            FieldList::create(
                FormAction::create('save', _t(__CLASS__.'SAVE', 'Save'))
                    ->setIcon('save')
                    ->setSchemaState([
                        'data' => [
                            'pristineTitle' => _t(__CLASS__.'SAVED', 'Saved'),
                            'pristineIcon' => 'tick',
                            'dirtyTitle' => _t(__CLASS__.'SAVE', 'Save'),
                            'dirtyIcon' => 'save',
                            'pristineClass' => 'btn-outline-primary',
                            'dirtyClass' => '',
                        ],
                    ]),
                FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel'))
                    ->setUseButtonTag(true)
            ),
            new RequiredFields('Name')
        );

        // Load into form
        $form->loadDataFrom($record);

        // Set form action handler with ID included
        $form->setRequestHandler(
            LeftAndMainFormRequestHandler::create($form, [ $id ])
        );

        // Configure form to respond to validation errors with form schema
        // if requested via react.
        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $id, $record) {
            $schemaId = Controller::join_links(
                $this->Link('schema'),
                'campaignEditForm',
                $id
            );
            return $this->getSchemaResponse($schemaId, $form, $errors);
        });

        $form->setNotifyUnsavedChanges(true);

        return $form;
    }
638728
public function getAction($id)
    {
        return $this->handleView(
            $this->view(
                $this->get('sulu_contact.country_repository')->find($id)
            )
        );
    }