[TYPO3-mvc] findBy[Property] problems
Lorenz Ulrich
lorenz-typo3 at visol.ch
Fri Feb 11 22:44:24 CET 2011
Hi Franz
> How are you processing $existing? $existing is no longer an array - as
> of extbase 1.3.0 it's an object, so you can't use stuff like
> "current($existing)" on it.
>
> If you expect only one result or none at all, give
> $this->addressRepository->findOneByEmail('...') a try.
In the version for Extbase 1.3 I just checked if $existing was set. I
know that it's an object now. I watched the object (with
PHPstorm/xdebug) but unfortunately the object only has this error and
some configuration information but not the requested data.
Same goes for findOneByEmail - I tried that, too and keep getting the
warning.
Thanks!
Lorenz
Am 11.02.2011 22:39, schrieb Franz Koch:
> Hey Lorenz,
>
>> Seems to be a pretty rough way for me to get into the extbase flow :-).
>>
>> I have an extension with an addressRepository that uses the tt_address
>> table. Saving new addresses works fine.
>>
>> But when inserting a new address I would like to check if it's a
>> duplicate. So I use this magic findBy[property] method:
>>
>> $existing = $this->addressRepository->findByEmail('mail at dress.com')
>>
>> But the only thing I get back is the following warning:
>>
>> You should never see this warning. If you do, you probably used PHP
>> array functions like current() on the
>> Tx_Extbase_Persistence_QueryResult. To retrieve the first result, you
>> can use the getFirst() method.
>
>
More information about the TYPO3-project-typo3v4mvc
mailing list