/**
  * @param Request $request
  * @param Created $payload
  */
 public function created(Request $request, Created $payload)
 {
     $serializer = FunctionPhase::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 = FunctionPhase::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['root-skills', 'skill']));
     $resource = $resource->fields($params->getFields(['function-phase' => FunctionPhase::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 = FunctionPhase::getSerializer();
     $resource = new Collection($data, $serializer);
     $resource = $resource->with($params->getInclude(['root-skills', 'skill']));
     $resource = $resource->fields($params->getFields(['function-phase' => FunctionPhase::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());
 }
 /**
  * Exclude object from result
  *
  * @param   ChildFunctionPhase $functionPhase Object to remove from the list of results
  *
  * @return $this|ChildFunctionPhaseQuery The current query, for fluid interface
  */
 public function prune($functionPhase = null)
 {
     if ($functionPhase) {
         $this->addUsingAlias(FunctionPhaseTableMap::COL_ID, $functionPhase->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Exemple #7
0
 /**
  * Filter the query by a related \gossi\trixionary\model\FunctionPhase object
  *
  * @param \gossi\trixionary\model\FunctionPhase|ObjectCollection $functionPhase 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 filterByFunctionPhaseRelatedBySkillId($functionPhase, $comparison = null)
 {
     if ($functionPhase instanceof \gossi\trixionary\model\FunctionPhase) {
         return $this->addUsingAlias(SkillTableMap::COL_ID, $functionPhase->getSkillId(), $comparison);
     } elseif ($functionPhase instanceof ObjectCollection) {
         return $this->useFunctionPhaseRelatedBySkillIdQuery()->filterByPrimaryKeys($functionPhase->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByFunctionPhaseRelatedBySkillId() only accepts arguments of type \\gossi\\trixionary\\model\\FunctionPhase or Collection');
     }
 }
 /**
  * @param Request $request
  * @param Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $serializer = FunctionPhase::getSerializer();
     $relationship = $serializer->rootSkills($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
Exemple #9
0
 /**
  * Sets a single ChildFunctionPhase object as related to this object by a one-to-one relationship.
  *
  * @param  ChildFunctionPhase $v ChildFunctionPhase
  * @return $this|\gossi\trixionary\model\StructureNode The current object (for fluent API support)
  * @throws PropelException
  */
 public function setFunctionPhase(ChildFunctionPhase $v = null)
 {
     $this->singleFunctionPhase = $v;
     // Make sure that that the passed-in ChildFunctionPhase isn't already associated with this object
     if ($v !== null && $v->getStructureNode(null, false) === null) {
         $v->setStructureNode($this);
     }
     return $this;
 }
 /**
  * Internal mechanism to set the Skill id
  * 
  * @param FunctionPhase $model
  * @param mixed $relatedId
  */
 protected function doSetSkillId(FunctionPhase $model, $relatedId)
 {
     if ($model->getSkillId() !== $relatedId) {
         $model->setSkillId($relatedId);
         return true;
     }
     return false;
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function read(Request $request, Found $payload)
 {
     $serializer = FunctionPhase::getSerializer();
     $relationship = $serializer->skill($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
 /**
  */
 public function getRelationships()
 {
     return ['sport' => Sport::getSerializer()->getType(null), 'variations' => Skill::getSerializer()->getType(null), 'variation-of' => Skill::getSerializer()->getType(null), 'multiples' => Skill::getSerializer()->getType(null), 'multiple-of' => Skill::getSerializer()->getType(null), 'object' => Object::getSerializer()->getType(null), 'start-position' => Position::getSerializer()->getType(null), 'end-position' => Position::getSerializer()->getType(null), 'featured-picture' => Picture::getSerializer()->getType(null), 'featured-video' => Video::getSerializer()->getType(null), 'featured-tutorial' => Video::getSerializer()->getType(null), 'kstruktur-root' => Kstruktur::getSerializer()->getType(null), 'function-phase-root' => FunctionPhase::getSerializer()->getType(null), 'children' => Skill::getSerializer()->getType(null), 'parents' => Skill::getSerializer()->getType(null), 'parts' => Skill::getSerializer()->getType(null), 'composites' => Skill::getSerializer()->getType(null), 'groups' => Group::getSerializer()->getType(null), 'references' => Reference::getSerializer()->getType(null), 'lineages' => Lineage::getSerializer()->getType(null), 'pictures' => Picture::getSerializer()->getType(null), 'videos' => Video::getSerializer()->getType(null), 'kstrukturs' => Kstruktur::getSerializer()->getType(null), 'function-phases' => FunctionPhase::getSerializer()->getType(null)];
 }