[TYPO3-mvc] how to get hidden element with standard method ?

Pankaj Lele pankaj at lelesys.com
Thu Sep 22 20:59:10 CEST 2011


Hello Dawid,

>  I want to get record from my db with
> $this->nameRepository->findByUid($uid)
> 
> the record is hidden (hidden = 1). How can i get it ? do i need to write
> my own method in repo ?

Yes, you have to create your own query. You can simply add a function
e.g. findHiddenByUid($uid) in your repository. The function code can be
like below:

$query = $this->createQuery();
$query->getQuerySettings()->setRespectSysLanguage(FALSE);		
$query->getQuerySettings()->setRespectStoragePage(FALSE);
$query->getQuerySettings()->setRespectEnableFields(FALSE); // because of
this line hidden objects can be retrieved
return $query
	->matching(
		$query->equals('uid', $uid)
	)
	->execute()
	->getFirst();

Hope that helps.

-- 

With best regards,
Pankaj Lele
---------------------------

CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India

Web: http://www.lelesys.com

[Certified TYPO3 Integrator]


More information about the TYPO3-project-typo3v4mvc mailing list