trackRepository->add($trackRequest); } /** * @param $id int|array * @return mixed * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Core\Exceptions\ConstraintException */ public function delete($id) { return $this->trackRepository->delete($id); } /** * @param TrackData $itemData * @return bool * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function update(TrackData $itemData) { return $this->trackRepository->update($itemData); } /** * @param $id int * @return TrackData */ public function getById($id) { return $this->trackRepository->getById($id); } /** * @return TrackData[] */ public function getAll() { return $this->trackRepository->getAll(); } /** * Devuelve los tracks de un cliente desde un tiempo y origen determinados * * @param TrackRequest $trackRequest * @return array */ public function getTracksForClientFromTime(TrackRequest $trackRequest) { return $this->trackRepository->getTracksForClientFromTime($trackRequest); } /** * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ public function initialize() { $this->trackRepository = $this->dic->get(TrackRepository::class); } /** * @param $source * @return TrackRequest * @throws \SP\Core\Exceptions\InvalidArgumentException */ public static function getTrackRequest($source) { $trackRequest = new TrackRequest(); $trackRequest->time = time() - self::TIME_TRACKING; $trackRequest->setTrackIp(HttpUtil::getClientAddress()); $trackRequest->source = $source; return $trackRequest; } }