/** * Returns TRUE only if a FrontendUser is currently logged in. Use argument * to return TRUE only if the FrontendUser logged in must be that specific user. * * @param Tx_Extbase_Domain_Model_FrontendUser $frontendUser * @return boolean * @api */ public function assertFrontendUserLoggedIn(Tx_Extbase_Domain_Model_FrontendUser $frontendUser = NULL) { $currentFrontendUser = $this->userService->getCurrentFrontendUser(); if (!$currentFrontendUser) { return FALSE; } if ($frontendUser && $currentFrontendUser) { if ($currentFrontendUser->getUid() === $frontendUser->getUid()) { return TRUE; } else { return FALSE; } } return is_object($currentFrontendUser); }
/** * Creates a new item object and persists it * so that we have an UID for it. * * @return Tx_Yag_Domain_Model_Item Persisted item */ protected function getNewPersistedItem() { $item = $this->objectManager->get('Tx_Yag_Domain_Model_Item'); if ($this->feUser) { $item->setFeUserUid($this->feUser->getUid()); } $this->itemRepository->add($item); $this->persistenceManager->persistAll(); return $item; }