[TYPO3-mvc] How to check if object was created ?

Franz Koch typo3.RemoveForMessage at elements-net.de
Tue Mar 8 11:19:52 CET 2011


Hey,

> About that obvious if construction its so obvious that I`ve checked it
> my first atempt. i wrote here cause it didn`t work :/
>
> My code looks like this
>
> $temp = $this->findByExtRec($resVal['uid']);
>
> if($temp !== NULL)
> echo "jest<br />";
> else
> echo "nie ma <br />";
>
> It always show "There is" even with empty database !

ok, if $this->findByExtRec() is a repository call in Extbase 1.3.+, then 
it'll return a QueryResult object. In this case do like Marc Bastian 
said. Or if you expect only one domain model/object to be returned use 
$repository->findOneByExtRec($uid) - then your if condition should work 
as expected.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list