Example #1
0
 /**
  * @param Skill $skill
  * @return array
  */
 private function getLineageIds(Skill $skill)
 {
     $ids = [];
     foreach ($skill->getLineages() as $lineage) {
         $ids[] = $lineage->getAncestor()->getId();
     }
     return $ids;
 }
Example #2
0
 /**
  * @param Skill $skill
  * @param mixed $data
  */
 protected function preSave(Skill $skill)
 {
     // set slug
     if (Text::create($skill->getSlug())->isEmpty()) {
         $name = str_replace('°', '', $skill->getName());
         $slugifier = new Slugify();
         $skill->setSlug($slugifier->slugify($name));
     }
     $this->isNew = $skill->isNew();
 }
 /**
  * @param Request $request
  * @param Created $payload
  */
 public function created(Request $request, Created $payload)
 {
     $serializer = Skill::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 Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $params = new Parameters($request->query->all());
     $serializer = Position::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['sport', 'skill']));
     $resource = $resource->fields($params->getFields(['position' => Position::getSerializer()->getFields(), 'sport' => Sport::getSerializer()->getFields(), 'skill' => Skill::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 = Reference::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['videos', 'skills']));
     $resource = $resource->fields($params->getFields(['reference' => Reference::getSerializer()->getFields(), 'video' => Video::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());
     $serializer = Object::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['sport', 'skills', 'skills.variations', 'skills.variationOf', 'skills.multiples', 'sport.objects']));
     $resource = $resource->fields($params->getFields(['object' => Object::getSerializer()->getFields(), 'sport' => Sport::getSerializer()->getFields(), 'skill' => Skill::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 = Sport::getSerializer();
     $resource = new Resource($payload->getModel(), $serializer);
     $resource = $resource->with($params->getInclude(['objects', 'positions', 'skills', 'groups', 'skills.groups', 'skills.objects', 'skills.start-position', 'skills.end-position', 'skills.variationOf', 'skills.parents', 'skills.lineages', 'skills.lineages.ancestor', 'skills.lineages.skill', 'skills.featured-picture']));
     $resource = $resource->fields($params->getFields(['sport' => Sport::getSerializer()->getFields(), 'object' => Object::getSerializer()->getFields(), 'position' => Position::getSerializer()->getFields(), 'skill' => Skill::getSerializer()->getFields(), 'group' => Group::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 = 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());
     $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 mixed $model
  * @return Relationship
  */
 public function skill($model)
 {
     $serializer = Skill::getSerializer();
     $id = $serializer->getId($model->getSkill());
     if ($id !== null) {
         $relationship = new Relationship(new Resource($model->getSkill(), $serializer));
         $relationship->setLinks(['related' => '%apiurl%' . $serializer->getType(null) . '/' . $id]);
         return $this->addRelationshipSelfLink($relationship, $model, 'skill');
     }
     return null;
 }
 /**
  * @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());
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function found(Request $request, Found $payload)
 {
     $params = new Parameters($request->query->all());
     $data = $payload->getModel();
     $serializer = Sport::getSerializer();
     $resource = new Collection($data, $serializer);
     $resource = $resource->with($params->getInclude(['objects', 'positions', 'skills', 'groups', 'skills.groups', 'skills.objects', 'skills.start-position', 'skills.end-position', 'skills.variationOf', 'skills.parents', 'skills.lineages', 'skills.lineages.ancestor', 'skills.lineages.skill', 'skills.featured-picture']));
     $resource = $resource->fields($params->getFields(['sport' => Sport::getSerializer()->getFields(), 'object' => Object::getSerializer()->getFields(), 'position' => Position::getSerializer()->getFields(), 'skill' => Skill::getSerializer()->getFields(), 'group' => Group::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());
 }
Example #13
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->aSkillRelatedByDependencyId) {
         $this->aSkillRelatedByDependencyId->removeChild($this);
     }
     if (null !== $this->aSkillRelatedByParentId) {
         $this->aSkillRelatedByParentId->removeParent($this);
     }
     $this->dependency_id = null;
     $this->parent_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 = 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());
 }
Example #15
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->aSkillRelatedByPartId) {
         $this->aSkillRelatedByPartId->removePart($this);
     }
     if (null !== $this->aSkillRelatedByCompositeId) {
         $this->aSkillRelatedByCompositeId->removeComposite($this);
     }
     $this->part_id = null;
     $this->composite_id = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #16
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->aSkill) {
         $this->aSkill->removeSkillReference($this);
     }
     if (null !== $this->aReference) {
         $this->aReference->removeSkillReference($this);
     }
     $this->skill_id = null;
     $this->reference_id = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #17
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->aSkill) {
         $this->aSkill->removeLineageRelatedBySkillId($this);
     }
     if (null !== $this->aAncestor) {
         $this->aAncestor->removeLineageRelatedByAncestorId($this);
     }
     $this->id = null;
     $this->skill_id = null;
     $this->ancestor_id = null;
     $this->position = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #18
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->aSkill) {
         $this->aSkill->removeStructureNode($this);
     }
     $this->id = null;
     $this->type = null;
     $this->skill_id = null;
     $this->title = null;
     $this->descendant_class = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #19
0
 /**
  * Filter the query by a related \gossi\trixionary\model\Skill object
  *
  * @param \gossi\trixionary\model\Skill|ObjectCollection $skill the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildFunctionPhaseQuery The current query, for fluid interface
  */
 public function filterByRootSkill($skill, $comparison = null)
 {
     if ($skill instanceof \gossi\trixionary\model\Skill) {
         return $this->addUsingAlias(FunctionPhaseTableMap::COL_ID, $skill->getFunctionPhaseId(), $comparison);
     } elseif ($skill instanceof ObjectCollection) {
         return $this->useRootSkillQuery()->filterByPrimaryKeys($skill->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByRootSkill() only accepts arguments of type \\gossi\\trixionary\\model\\Skill or Collection');
     }
 }
Example #20
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->aSkill) {
         $this->aSkill->removePicture($this);
     }
     $this->id = null;
     $this->title = null;
     $this->description = null;
     $this->url = null;
     $this->thumb_url = null;
     $this->skill_id = null;
     $this->photographer = null;
     $this->photographer_id = null;
     $this->athlete = null;
     $this->athlete_id = null;
     $this->uploader_id = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #21
0
 /**
  * Internal mechanism to set the VariationOf id
  * 
  * @param Skill $model
  * @param mixed $relatedId
  */
 protected function doSetVariationOfId(Skill $model, $relatedId)
 {
     if ($model->getVariationOfId() !== $relatedId) {
         $model->setVariationOfId($relatedId);
         return true;
     }
     return false;
 }
Example #22
0
 /**
  * Returns the url for the given skill
  * @param Skill $skill
  * @return string
  */
 public function getSkillUrl(Skill $skill)
 {
     return $this->getSkillsUrl($skill->getSport()) . '/' . $this->getSkillSegment($skill);
 }
Example #23
0
 /**
  * @param ChildSkill $skill The ChildSkill object to add.
  */
 protected function doAddSkill(ChildSkill $skill)
 {
     $this->collSkills[] = $skill;
     $skill->setObject($this);
 }
 /**
  * @param Request $request
  * @param Found $payload
  */
 public function read(Request $request, Found $payload)
 {
     $serializer = Skill::getSerializer();
     $relationship = $serializer->variationOf($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
Example #25
0
 /**
  * Filter the query by a related \gossi\trixionary\model\Skill object
  *
  * @param \gossi\trixionary\model\Skill|ObjectCollection $skill 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 ChildSkillPartQuery The current query, for fluid interface
  */
 public function filterBySkillRelatedByCompositeId($skill, $comparison = null)
 {
     if ($skill instanceof \gossi\trixionary\model\Skill) {
         return $this->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $skill->getId(), $comparison);
     } elseif ($skill instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(SkillPartTableMap::COL_COMPOSITE_ID, $skill->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterBySkillRelatedByCompositeId() only accepts arguments of type \\gossi\\trixionary\\model\\Skill or Collection');
     }
 }
Example #26
0
 /**
  * Exclude object from result
  *
  * @param   ChildSkill $skill Object to remove from the list of results
  *
  * @return $this|ChildSkillQuery The current query, for fluid interface
  */
 public function prune($skill = null)
 {
     if ($skill) {
         $this->addUsingAlias(SkillTableMap::COL_ID, $skill->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Example #27
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->aSkill) {
         $this->aSkill->removeSkillVersion($this);
     }
     $this->id = null;
     $this->sport_id = null;
     $this->name = null;
     $this->alternative_name = null;
     $this->slug = null;
     $this->description = null;
     $this->history = null;
     $this->is_translation = null;
     $this->is_rotation = null;
     $this->is_acyclic = null;
     $this->is_cyclic = null;
     $this->longitudinal_flags = null;
     $this->latitudinal_flags = null;
     $this->transversal_flags = null;
     $this->movement_description = null;
     $this->sequence_picture_url = null;
     $this->variation_of_id = null;
     $this->start_position_id = null;
     $this->end_position_id = null;
     $this->is_composite = null;
     $this->is_multiple = null;
     $this->multiple_of_id = null;
     $this->multiplier = null;
     $this->generation = null;
     $this->importance = null;
     $this->picture_id = null;
     $this->video_id = null;
     $this->tutorial_id = null;
     $this->kstruktur_id = null;
     $this->function_phase_id = null;
     $this->object_id = null;
     $this->version = null;
     $this->version_created_at = null;
     $this->version_comment = null;
     $this->variation_of_id_version = null;
     $this->multiple_of_id_version = null;
     $this->kk_trixionary_skill_ids = null;
     $this->kk_trixionary_skill_ids_unserialized = null;
     $this->kk_trixionary_skill_versions = null;
     $this->kk_trixionary_skill_versions_unserialized = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->applyDefaultValues();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
 /**
  * @param Request $request
  * @param Updated $payload
  */
 public function updated(Request $request, Updated $payload)
 {
     $serializer = Skill::getSerializer();
     $relationship = $serializer->pictures($payload->getModel());
     return new JsonResponse($relationship->toArray());
 }
Example #29
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->aStructureNode) {
         $this->aStructureNode->removeKstruktur($this);
     }
     if (null !== $this->aSkillRelatedBySkillId) {
         $this->aSkillRelatedBySkillId->removeKstrukturRelatedBySkillId($this);
     }
     $this->id = null;
     $this->type = null;
     $this->skill_id = null;
     $this->title = null;
     $this->alreadyInSave = false;
     $this->clearAllReferences();
     $this->resetModified();
     $this->setNew(true);
     $this->setDeleted(false);
 }
Example #30
0
 /**
  * @param ChildSkill $skillRelatedByEndPositionId The ChildSkill object to add.
  */
 protected function doAddSkillRelatedByEndPositionId(ChildSkill $skillRelatedByEndPositionId)
 {
     $this->collSkillsRelatedByEndPositionId[] = $skillRelatedByEndPositionId;
     $skillRelatedByEndPositionId->setEndPosition($this);
 }