/**
  * @param Request $request
  * @param Created $payload
  */
 public function created(Request $request, Created $payload)
 {
     $serializer = ApplicationUri::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 201, ['Location' => $resource->getLinks()['self']]);
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Application::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['application-uris']));
     $resource = $resource->fields($params->getFields(['application' => Application::getSerializer()->getFields(), 'application-uri' => ApplicationUri::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
 /**
  * @param Request $request
  * @param Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Localization::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['localizations', 'parent', 'language', 'ext-lang', 'script', 'language-variants', 'application-uris']));
     $resource = $resource->fields($params->getFields(['localization' => Localization::getSerializer()->getFields(), 'parent' => Localization::getSerializer()->getFields(), 'language' => Language::getSerializer()->getFields(), 'ext-lang' => Language::getSerializer()->getFields(), 'script' => LanguageScript::getSerializer()->getFields(), 'language-variant' => LanguageVariant::getSerializer()->getFields(), 'application-uri' => ApplicationUri::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $data = $payload->getModel();
     $serializer = ApplicationUri::getSerializer();
     $resource = new Collection($data, $serializer);
     $resource = $resource->with($params->getInclude(['application', 'localization']));
     $resource = $resource->fields($params->getFields(['application-uri' => ApplicationUri::getSerializer()->getFields(), 'application' => Application::getSerializer()->getFields(), 'localization' => Localization::getSerializer()->getFields()]));
     $document = new Document($resource);
     // meta
     if ($params->getPage('size') != -1) {
         $document->setMeta(['total' => $data->getNbResults(), 'first' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getFirstPage()]]), 'next' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getNextPage()]]), 'previous' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getPreviousPage()]]), 'last' => '%apiurl%/' . $serializer->getType(null) . '?' . $params->toQueryString(['page' => ['number' => $data->getLastPage()]])]);
     }
     // return response
     return new JsonResponse($document->toArray());
 }
 /**
  */
 public function getRelationships()
 {
     return ['localizations' => Localization::getSerializer()->getType(null), 'parent' => Localization::getSerializer()->getType(null), 'language' => Language::getSerializer()->getType(null), 'ext-lang' => Language::getSerializer()->getType(null), 'script' => LanguageScript::getSerializer()->getType(null), 'language-variants' => LanguageVariant::getSerializer()->getType(null), 'application-uris' => ApplicationUri::getSerializer()->getType(null)];
 }
Exemple #6
0
 /**
  * Filter the query by a related \keeko\core\model\ApplicationUri object
  *
  * @param \keeko\core\model\ApplicationUri|ObjectCollection $applicationUri the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildApplicationQuery The current query, for fluid interface
  */
 public function filterByApplicationUri($applicationUri, $comparison = null)
 {
     if ($applicationUri instanceof \keeko\core\model\ApplicationUri) {
         return $this->addUsingAlias(ApplicationTableMap::COL_ID, $applicationUri->getApplicationId(), $comparison);
     } elseif ($applicationUri instanceof ObjectCollection) {
         return $this->useApplicationUriQuery()->filterByPrimaryKeys($applicationUri->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByApplicationUri() only accepts arguments of type \\keeko\\core\\model\\ApplicationUri or Collection');
     }
 }
 /**
  * Internal mechanism to set the Localization id
  * 
  * @param ApplicationUri $model
  * @param mixed $relatedId
  */
 protected function doSetLocalizationId(ApplicationUri $model, $relatedId)
 {
     if ($model->getLocalizationId() !== $relatedId) {
         $model->setLocalizationId($relatedId);
         return true;
     }
     return false;
 }
Exemple #8
0
 /**
  * @param ChildApplicationUri $applicationUri The ChildApplicationUri object to add.
  */
 protected function doAddApplicationUri(ChildApplicationUri $applicationUri)
 {
     $this->collApplicationUris[] = $applicationUri;
     $applicationUri->setLocalization($this);
 }
 /**
  */
 public function getRelationships()
 {
     return ['application-uris' => ApplicationUri::getSerializer()->getType(null)];
 }
Exemple #10
0
 /**
  * Exclude object from result
  *
  * @param   ChildApplicationUri $applicationUri Object to remove from the list of results
  *
  * @return $this|ChildApplicationUriQuery The current query, for fluid interface
  */
 public function prune($applicationUri = null)
 {
     if ($applicationUri) {
         $this->addUsingAlias(ApplicationUriTableMap::COL_ID, $applicationUri->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function read(Request $request, Found $payload)
 {
     $serializer = ApplicationUri::getSerializer();
     $relationship = $serializer->application($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
 /**
  * Returns the localization of this app
  *
  * @return Localization
  */
 public function getLocalization()
 {
     return $this->uri->getLocalization();
 }