/**
  * @param Request $request
  * @param Created $payload
  */
 public function created(Request $request, Created $payload)
 {
     $serializer = Kstruktur::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 = Skill::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['sport', 'variations', 'variation-of', 'multiples', 'multiple-of', 'object', 'start-position', 'end-position', 'featured-picture', 'featured-video', 'featured-tutorial', 'kstruktur-root', 'function-phase-root', 'children', 'parents', 'parts', 'composites', 'groups', 'references', 'lineages', 'pictures', 'videos', 'kstrukturs', 'function-phases', 'sport.skills']));
     $resource = $resource->fields($params->getFields(['skill' => Skill::getSerializer()->getFields(), 'sport' => Sport::getSerializer()->getFields(), 'variation' => Skill::getSerializer()->getFields(), 'variation-of' => Skill::getSerializer()->getFields(), 'multiple' => Skill::getSerializer()->getFields(), 'multiple-of' => Skill::getSerializer()->getFields(), 'object' => Object::getSerializer()->getFields(), 'start-position' => Position::getSerializer()->getFields(), 'end-position' => Position::getSerializer()->getFields(), 'featured-picture' => Picture::getSerializer()->getFields(), 'featured-video' => Video::getSerializer()->getFields(), 'featured-tutorial' => Video::getSerializer()->getFields(), 'kstruktur-root' => Kstruktur::getSerializer()->getFields(), 'function-phase-root' => FunctionPhase::getSerializer()->getFields(), 'child' => Skill::getSerializer()->getFields(), 'parent' => Skill::getSerializer()->getFields(), 'part' => Skill::getSerializer()->getFields(), 'composite' => Skill::getSerializer()->getFields(), 'group' => Group::getSerializer()->getFields(), 'reference' => Reference::getSerializer()->getFields(), 'lineage' => Lineage::getSerializer()->getFields(), 'picture' => Picture::getSerializer()->getFields(), 'video' => Video::getSerializer()->getFields(), 'kstruktur' => Kstruktur::getSerializer()->getFields(), 'function-phase' => FunctionPhase::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 = Kstruktur::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['root-skills', 'skill']));
     $resource = $resource->fields($params->getFields(['kstruktur' => Kstruktur::getSerializer()->getFields(), 'root-skill' => Skill::getSerializer()->getFields(), 'skill' => Skill::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 = Kstruktur::getSerializer();
     $resource = new Collection($data, $serializer);
     $resource = $resource->with($params->getInclude(['root-skills', 'skill']));
     $resource = $resource->fields($params->getFields(['kstruktur' => Kstruktur::getSerializer()->getFields(), 'root-skill' => Skill::getSerializer()->getFields(), 'skill' => Skill::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 found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $data = $payload->getModel();
     $serializer = Skill::getSerializer();
     $resource = new Collection($data, $serializer);
     $resource = $resource->with($params->getInclude(['sport', 'variations', 'variation-of', 'multiples', 'multiple-of', 'object', 'start-position', 'end-position', 'featured-picture', 'featured-video', 'featured-tutorial', 'kstruktur-root', 'function-phase-root', 'children', 'parents', 'parts', 'composites', 'groups', 'references', 'lineages', 'pictures', 'videos', 'kstrukturs', 'function-phases', 'sport.skills']));
     $resource = $resource->fields($params->getFields(['skill' => Skill::getSerializer()->getFields(), 'sport' => Sport::getSerializer()->getFields(), 'variation' => Skill::getSerializer()->getFields(), 'variation-of' => Skill::getSerializer()->getFields(), 'multiple' => Skill::getSerializer()->getFields(), 'multiple-of' => Skill::getSerializer()->getFields(), 'object' => Object::getSerializer()->getFields(), 'start-position' => Position::getSerializer()->getFields(), 'end-position' => Position::getSerializer()->getFields(), 'featured-picture' => Picture::getSerializer()->getFields(), 'featured-video' => Video::getSerializer()->getFields(), 'featured-tutorial' => Video::getSerializer()->getFields(), 'kstruktur-root' => Kstruktur::getSerializer()->getFields(), 'function-phase-root' => FunctionPhase::getSerializer()->getFields(), 'child' => Skill::getSerializer()->getFields(), 'parent' => Skill::getSerializer()->getFields(), 'part' => Skill::getSerializer()->getFields(), 'composite' => Skill::getSerializer()->getFields(), 'group' => Group::getSerializer()->getFields(), 'reference' => Reference::getSerializer()->getFields(), 'lineage' => Lineage::getSerializer()->getFields(), 'picture' => Picture::getSerializer()->getFields(), 'video' => Video::getSerializer()->getFields(), 'kstruktur' => Kstruktur::getSerializer()->getFields(), 'function-phase' => FunctionPhase::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());
 }
Esempio n. 6
0
 /**
  * Filter the query by a related \gossi\trixionary\model\Kstruktur object
  *
  * @param \gossi\trixionary\model\Kstruktur|ObjectCollection $kstruktur the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildSkillQuery The current query, for fluid interface
  */
 public function filterByKstrukturRelatedBySkillId($kstruktur, $comparison = null)
 {
     if ($kstruktur instanceof \gossi\trixionary\model\Kstruktur) {
         return $this->addUsingAlias(SkillTableMap::COL_ID, $kstruktur->getSkillId(), $comparison);
     } elseif ($kstruktur instanceof ObjectCollection) {
         return $this->useKstrukturRelatedBySkillIdQuery()->filterByPrimaryKeys($kstruktur->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByKstrukturRelatedBySkillId() only accepts arguments of type \\gossi\\trixionary\\model\\Kstruktur or Collection');
     }
 }
Esempio n. 7
0
 /**
  * Sets a single ChildKstruktur object as related to this object by a one-to-one relationship.
  *
  * @param  ChildKstruktur $v ChildKstruktur
  * @return $this|\gossi\trixionary\model\StructureNode The current object (for fluent API support)
  * @throws PropelException
  */
 public function setKstruktur(ChildKstruktur $v = null)
 {
     $this->singleKstruktur = $v;
     // Make sure that that the passed-in ChildKstruktur isn't already associated with this object
     if ($v !== null && $v->getStructureNode(null, false) === null) {
         $v->setStructureNode($this);
     }
     return $this;
 }
Esempio n. 8
0
 /**
  * Exclude object from result
  *
  * @param   ChildKstruktur $kstruktur Object to remove from the list of results
  *
  * @return $this|ChildKstrukturQuery The current query, for fluid interface
  */
 public function prune($kstruktur = null)
 {
     if ($kstruktur) {
         $this->addUsingAlias(KstrukturTableMap::COL_ID, $kstruktur->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function read(Request $request, Found $payload)
 {
     $serializer = Kstruktur::getSerializer();
     $relationship = $serializer->skill($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
Esempio n. 10
0
 /**
  * @param mixed $model
  * @return Relationship
  */
 public function kstrukturs($model)
 {
     $method = 'get' . $this->getCollectionMethodPluralName('kstrukturs');
     $relationship = new Relationship(new Collection($model->{$method}(), Kstruktur::getSerializer()));
     return $this->addRelationshipSelfLink($relationship, $model, 'kstruktur');
 }
 /**
  * @param Request $request
  * @param Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $serializer = Kstruktur::getSerializer();
     $relationship = $serializer->rootSkills($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
Esempio n. 12
0
 /**
  * Internal mechanism to set the Skill id
  * 
  * @param Kstruktur $model
  * @param mixed $relatedId
  */
 protected function doSetSkillId(Kstruktur $model, $relatedId)
 {
     if ($model->getSkillId() !== $relatedId) {
         $model->setSkillId($relatedId);
         return true;
     }
     return false;
 }