public function analyze(Event $event) { foreach ($event->getStartgroups() as $group) { $this->analyzeGroup($group); } $this->processSummary($event, $this->all); $event->save(); }
/** * @param Request $request * @param Created $payload */ public function created(Request $request, Created $payload) { $serializer = Event::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 = Startgroup::getSerializer(); $resource = new Resource($payload->getModel(), $serializer); $resource = $resource->with($params->getInclude(['competition', 'event', 'performance-total-statistic', 'performance-execution-statistic', 'performance-choreography-statistic', 'performance-music-and-timing-statistic', 'routines', 'judges', 'routines.performance-total-statistic', 'routines.performance-execution-statistic', 'routines.performance-choreography-statistic', 'routines.performance-music-and-timing-statistic', 'routines.performance-scores', 'routines.performance-scores.judge'])); $resource = $resource->fields($params->getFields(['startgroup' => Startgroup::getSerializer()->getFields(), 'competition' => Competition::getSerializer()->getFields(), 'event' => Event::getSerializer()->getFields(), 'performance-total-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-execution-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-choreography-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-music-and-timing-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'routine' => Routine::getSerializer()->getFields(), 'judge' => Judge::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 = PerformanceStatistic::getSerializer(); $resource = new Resource($payload->getModel(), $serializer); $resource = $resource->with($params->getInclude(['events', 'startgroups', 'routine'])); $resource = $resource->fields($params->getFields(['performance-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'event' => Event::getSerializer()->getFields(), 'startgroup' => Startgroup::getSerializer()->getFields(), 'routine' => Routine::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 = Startgroup::getSerializer(); $resource = new Collection($data, $serializer); $resource = $resource->with($params->getInclude(['competition', 'event', 'performance-total-statistic', 'performance-execution-statistic', 'performance-choreography-statistic', 'performance-music-and-timing-statistic', 'routines', 'judges', 'routines.performance-total-statistic', 'routines.performance-execution-statistic', 'routines.performance-choreography-statistic', 'routines.performance-music-and-timing-statistic', 'routines.performance-scores', 'routines.performance-scores.judge'])); $resource = $resource->fields($params->getFields(['startgroup' => Startgroup::getSerializer()->getFields(), 'competition' => Competition::getSerializer()->getFields(), 'event' => Event::getSerializer()->getFields(), 'performance-total-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-execution-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-choreography-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'performance-music-and-timing-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'routine' => Routine::getSerializer()->getFields(), 'judge' => Judge::getSerializer()->getFields()])); $document = new Document($resource); // meta $document->setMeta(['total' => $data->getNbResults(), 'first' => $data->getFirstPage(), 'next' => $data->getNextPage(), 'previous' => $data->getPreviousPage(), 'last' => $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 = PerformanceStatistic::getSerializer(); $resource = new Collection($data, $serializer); $resource = $resource->with($params->getInclude(['events', 'startgroups', 'routine'])); $resource = $resource->fields($params->getFields(['performance-statistic' => PerformanceStatistic::getSerializer()->getFields(), 'event' => Event::getSerializer()->getFields(), 'startgroup' => Startgroup::getSerializer()->getFields(), 'routine' => Routine::getSerializer()->getFields()])); $document = new Document($resource); // meta $document->setMeta(['total' => $data->getNbResults(), 'first' => $data->getFirstPage(), 'next' => $data->getNextPage(), 'previous' => $data->getPreviousPage(), 'last' => $data->getLastPage()]); // return response return new JsonResponse($document->toArray()); }
/** * Filter the query by a related \iuf\junia\model\Event object * * @param \iuf\junia\model\Event|ObjectCollection $event the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildPerformanceStatisticQuery The current query, for fluid interface */ public function filterByEventRelatedByPerformanceMusicAndTimingStatisticId($event, $comparison = null) { if ($event instanceof \iuf\junia\model\Event) { return $this->addUsingAlias(PerformanceStatisticTableMap::COL_ID, $event->getPerformanceMusicAndTimingStatisticId(), $comparison); } elseif ($event instanceof ObjectCollection) { return $this->useEventRelatedByPerformanceMusicAndTimingStatisticIdQuery()->filterByPrimaryKeys($event->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByEventRelatedByPerformanceMusicAndTimingStatisticId() only accepts arguments of type \\iuf\\junia\\model\\Event or Collection'); } }
/** * Exclude object from result * * @param ChildEvent $event Object to remove from the list of results * * @return $this|ChildEventQuery The current query, for fluid interface */ public function prune($event = null) { if ($event) { $this->addUsingAlias(EventTableMap::COL_ID, $event->getId(), Criteria::NOT_EQUAL); } return $this; }
/** */ public function getRelationships() { return ['competition' => Competition::getSerializer()->getType(null), 'event' => Event::getSerializer()->getType(null), 'performance-total-statistic' => PerformanceStatistic::getSerializer()->getType(null), 'performance-execution-statistic' => PerformanceStatistic::getSerializer()->getType(null), 'performance-choreography-statistic' => PerformanceStatistic::getSerializer()->getType(null), 'performance-music-and-timing-statistic' => PerformanceStatistic::getSerializer()->getType(null), 'routines' => Routine::getSerializer()->getType(null), 'judges' => Judge::getSerializer()->getType(null)]; }
/** * Filter the query by a related \iuf\junia\model\Event object * * @param \iuf\junia\model\Event|ObjectCollection $event 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 ChildStartgroupQuery The current query, for fluid interface */ public function filterByEvent($event, $comparison = null) { if ($event instanceof \iuf\junia\model\Event) { return $this->addUsingAlias(StartgroupTableMap::COL_EVENT_ID, $event->getId(), $comparison); } elseif ($event instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(StartgroupTableMap::COL_EVENT_ID, $event->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByEvent() only accepts arguments of type \\iuf\\junia\\model\\Event or Collection'); } }
/** */ public function getRelationships() { return ['events' => Event::getSerializer()->getType(null), 'startgroups' => Startgroup::getSerializer()->getType(null), 'routine' => Routine::getSerializer()->getType(null)]; }
/** * @param Request $request * @param Found $payload */ public function read(Request $request, Found $payload) { $serializer = Event::getSerializer(); $relationship = $serializer->performanceChoreographyStatistic($payload->getModel()); return new JsonResponse($relationship->toArray()); }
/** * Updates a Event with the given idand the provided data * * @param mixed $id * @param mixed $data * @return PayloadInterface */ public function update($id, $data) { // find $model = $this->get($id); if ($model === null) { return new NotFound(['message' => 'Event not found.']); } // hydrate $serializer = Event::getSerializer(); $model = $serializer->hydrate($model, $data); // validate $validator = $this->getValidator(); if ($validator !== null && !$validator->validate($model)) { return new NotValid(['errors' => $validator->getValidationFailures()]); } // dispatch $event = new EventEvent($model); $dispatcher = $this->getServiceContainer()->getDispatcher(); $dispatcher->dispatch(EventEvent::PRE_UPDATE, $event); $dispatcher->dispatch(EventEvent::PRE_SAVE, $event); $rows = $model->save(); $dispatcher->dispatch(EventEvent::POST_UPDATE, $event); $dispatcher->dispatch(EventEvent::POST_SAVE, $event); $payload = ['model' => $model]; if ($rows === 0) { return new NotUpdated($payload); } return new Updated($payload); }
/** * 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->aCompetition) { $this->aCompetition->removeStartgroup($this); } if (null !== $this->aEvent) { $this->aEvent->removeStartgroup($this); } if (null !== $this->aPerformanceTotalStatistic) { $this->aPerformanceTotalStatistic->removeStartgroupRelatedByPerformanceTotalStatisticId($this); } if (null !== $this->aPerformanceExecutionStatistic) { $this->aPerformanceExecutionStatistic->removeStartgroupRelatedByPerformanceExecutionStatisticId($this); } if (null !== $this->aPerformanceChoreographyStatistic) { $this->aPerformanceChoreographyStatistic->removeStartgroupRelatedByPerformanceChoreographyStatisticId($this); } if (null !== $this->aPerformanceMusicAndTimingStatistic) { $this->aPerformanceMusicAndTimingStatistic->removeStartgroupRelatedByPerformanceMusicAndTimingStatisticId($this); } $this->id = null; $this->name = null; $this->slug = null; $this->competition_id = null; $this->event_id = null; $this->performance_total_statistic_id = null; $this->performance_execution_statistic_id = null; $this->performance_choreography_statistic_id = null; $this->performance_music_and_timing_statistic_id = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
/** * @param ChildEvent $eventRelatedByPerformanceMusicAndTimingStatisticId The ChildEvent object to add. */ protected function doAddEventRelatedByPerformanceMusicAndTimingStatisticId(ChildEvent $eventRelatedByPerformanceMusicAndTimingStatisticId) { $this->collEventsRelatedByPerformanceMusicAndTimingStatisticId[] = $eventRelatedByPerformanceMusicAndTimingStatisticId; $eventRelatedByPerformanceMusicAndTimingStatisticId->setPerformanceMusicAndTimingStatistic($this); }
/** * @param Request $request * @param Updated $payload */ public function updated(Request $request, Updated $payload) { $serializer = Event::getSerializer(); $relationship = $serializer->startgroups($payload->getModel()); return new JsonResponse($relationship->toArray()); }