/**
  * @param Request $request
  * @param Created $payload
  */
 public function created(Request $request, Created $payload)
 {
     $serializer = Localization::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 201, ['Location' => $resource->getLinks()['self']]);
 }
Esempio n. 2
0
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Language::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['sublanguages', 'parent', 'scope', 'type', 'script', 'family', 'localizations']));
     $resource = $resource->fields($params->getFields(['language' => Language::getSerializer()->getFields(), 'sublanguage' => Language::getSerializer()->getFields(), 'parent' => Language::getSerializer()->getFields(), 'scope' => LanguageScope::getSerializer()->getFields(), 'type' => LanguageType::getSerializer()->getFields(), 'script' => LanguageScript::getSerializer()->getFields(), 'family' => LanguageFamily::getSerializer()->getFields(), 'localization' => Localization::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 = ApplicationUri::getSerializer();
     $resource = new Resource($payload->getModel(), $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);
     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());
     $serializer = LanguageVariant::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['localizations']));
     $resource = $resource->fields($params->getFields(['language-variant' => LanguageVariant::getSerializer()->getFields(), 'localization' => Localization::getSerializer()->getFields()]));
     $document = new Document($resource);
     return new JsonResponse($document->toArray(), 200);
 }
Esempio n. 6
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aLocalization) {
         $this->aLocalization->removeLocalizationVariant($this);
     }
     if (null !== $this->aLanguageVariant) {
         $this->aLanguageVariant->removeLocalizationVariant($this);
     }
     $this->localization_id = null;
     $this->variant_id = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 /**
  * @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());
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function read(Request $request, Found $payload)
 {
     $serializer = Localization::getSerializer();
     $relationship = $serializer->parent($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
Esempio n. 9
0
 /**
  * @param mixed $model
  * @return Relationship
  */
 public function parent($model)
 {
     $serializer = Localization::getSerializer();
     $id = $serializer->getId($model->getParent());
     if ($id !== null) {
         $relationship = new Relationship(new Resource($model->getParent(), $serializer));
         $relationship->setLinks(['related' => '%apiurl%' . $serializer->getType(null) . '/' . $id]);
         return $this->addRelationshipSelfLink($relationship, $model, 'parent');
     }
     return null;
 }
Esempio n. 10
0
 /**
  * @param ChildLocalization $localization The ChildLocalization object to add.
  */
 protected function doAddLocalization(ChildLocalization $localization)
 {
     $this->collLocalizations[] = $localization;
     $localization->setScript($this);
 }
Esempio n. 11
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aParent) {
         $this->aParent->removeLocalizationRelatedById($this);
     }
     if (null !== $this->aLanguage) {
         $this->aLanguage->removeLocalizationRelatedByLanguageId($this);
     }
     if (null !== $this->aExtLang) {
         $this->aExtLang->removeLocalizationRelatedByExtLanguageId($this);
     }
     if (null !== $this->aScript) {
         $this->aScript->removeLocalization($this);
     }
     $this->id = null;
     $this->parent_id = null;
     $this->name = null;
     $this->locale = null;
     $this->language_id = null;
     $this->ext_language_id = null;
     $this->region = null;
     $this->script_id = null;
     $this->is_default = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Esempio n. 12
0
 /**
  * Clears the current object, sets all attributes to their default values and removes
  * outgoing references as well as back-references (from other objects to this one. Results probably in a database
  * change of those foreign objects when you call `save` there).
  */
 public function clear()
 {
     if (null !== $this->aApplication) {
         $this->aApplication->removeApplicationUri($this);
     }
     if (null !== $this->aLocalization) {
         $this->aLocalization->removeApplicationUri($this);
     }
     $this->id = null;
     $this->httphost = null;
     $this->basepath = null;
     $this->secure = null;
     $this->application_id = null;
     $this->localization_id = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Esempio n. 13
0
 /**
  * Filter the query by a related \keeko\core\model\Localization object
  *
  * @param \keeko\core\model\Localization|ObjectCollection $localization The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildApplicationUriQuery The current query, for fluid interface
  */
 public function filterByLocalization($localization, $comparison = null)
 {
     if ($localization instanceof \keeko\core\model\Localization) {
         return $this->addUsingAlias(ApplicationUriTableMap::COL_LOCALIZATION_ID, $localization->getId(), $comparison);
     } elseif ($localization instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ApplicationUriTableMap::COL_LOCALIZATION_ID, $localization->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByLocalization() only accepts arguments of type \\keeko\\core\\model\\Localization or Collection');
     }
 }
 /**
  * @param Request $request
  * @param Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $serializer = Localization::getSerializer();
     $relationship = $serializer->languageVariants($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
Esempio n. 15
0
 /**
  * Filter the query by a related \keeko\core\model\Localization object
  *
  * @param \keeko\core\model\Localization|ObjectCollection $localization the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildLanguageScriptQuery The current query, for fluid interface
  */
 public function filterByLocalization($localization, $comparison = null)
 {
     if ($localization instanceof \keeko\core\model\Localization) {
         return $this->addUsingAlias(LanguageScriptTableMap::COL_ID, $localization->getScriptId(), $comparison);
     } elseif ($localization instanceof ObjectCollection) {
         return $this->useLocalizationQuery()->filterByPrimaryKeys($localization->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByLocalization() only accepts arguments of type \\keeko\\core\\model\\Localization or Collection');
     }
 }
Esempio n. 16
0
 /**
  * Internal mechanism to set the Script id
  * 
  * @param Localization $model
  * @param mixed $relatedId
  */
 protected function doSetScriptId(Localization $model, $relatedId)
 {
     if ($model->getScriptId() !== $relatedId) {
         $model->setScriptId($relatedId);
         return true;
     }
     return false;
 }
Esempio n. 17
0
 /**
  * @param ChildLocalization $localizationRelatedByExtLanguageId The ChildLocalization object to add.
  */
 protected function doAddLocalizationRelatedByExtLanguageId(ChildLocalization $localizationRelatedByExtLanguageId)
 {
     $this->collLocalizationsRelatedByExtLanguageId[] = $localizationRelatedByExtLanguageId;
     $localizationRelatedByExtLanguageId->setExtLang($this);
 }
Esempio n. 18
0
 /**
  * Exclude object from result
  *
  * @param   ChildLocalization $localization Object to remove from the list of results
  *
  * @return $this|ChildLocalizationQuery The current query, for fluid interface
  */
 public function prune($localization = null)
 {
     if ($localization) {
         $this->addUsingAlias(LocalizationTableMap::COL_ID, $localization->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }