PartKeepr\TipOfTheDayBundle\Action\MarkTipReadAction::__invoke PHP Method

__invoke() public method

Marks a specific tip as read.
public __invoke ( Request $request, integer $id ) : array | Dunglas\ApiBundle\Model\PaginatorInterface | Traversable
$request Symfony\Component\HttpFoundation\Request The request
$id integer The ID of the system notice
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;
    }
MarkTipReadAction