[TYPO3-mvc] Create model by uid
Franz Koch
typo3.RemoveForMessage at elements-net.de
Thu Dec 16 10:50:46 CET 2010
Hi,
> My problem: After calling
> myplugin[category]=5&myplugin[action]=show&myplugin[controller]=Category
>
> the “navigationAction” does not get “Category” model. Only the “showAction”
> gets “Category” model.
>
>
> Question: How can I create “Category” model by uid in navigationAction? I
> can get the uid using $this->request->getArguments() method.
fetch it from the repository - easy as that
$arguments = $this->request->getArguments();
if (isset($arguments['category']) {
$categoryId = intval($arguments['category']);
// assuming you created your repository already in the initializeAction
method
$category = $this->categoryRepository->findByUid($categoryId);
// do whatever you want with your category
}
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list