/**
* Marks a specific tip as read.
*
* @param Request $request The request
* @param int $id The ID of the system notice
*
* @throws RuntimeException
*
* @return array|\Dunglas\ApiBundle\Model\PaginatorInterface|\Traversable
*/
public function __invoke(Request $request, $id)
{
list($resourceType) = $this->extractAttributes($request);
$tip = $this->getItem($this->dataProvider, $resourceType, $id);
/*
* @var $tip TipOfTheDay
*/
$tipOfTheDayHistoryItem = new TipOfTheDayHistory();
$tipOfTheDayHistoryItem->setUser($this->userService->getUser());
$tipOfTheDayHistoryItem->setName($tip->getName());
$this->entityManager->persist($tipOfTheDayHistoryItem);
$this->entityManager->flush();
return $tip;
}