[TYPO3-mvc] Strange warning "You should never see it"

Sebastian Kurfürst sebastian at typo3.org
Wed Jan 19 18:00:16 CET 2011


Hey Dawid,

> I get nothing in my listAction
This means you do not get any results?

> when I used var_dump($records) I receive
> 
> object(Tx_Extbase_Persistence_QueryResult)[112]
>   private 'warning' => string '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.' (length=206)
That's no problem you need to take care of; it is just to inform
developers of legacy code that they need to do something; Details at
http://forge.typo3.org/projects/typo3v4-mvc/wiki/QueryResult

The warning is only implemented because PHP sucks ;-) If you do
current($object), then PHP will return THE FIRST property of the object,
no matter it's visibility (which is plain wrong and inconsistent).
Before Extbase 1.4, $query->execute() returned an *array*, where you
could of course do current($array). Extbase 1.4 returns a QueryResult
*object*, which is basically executing your query lazily as needed. But
in order to give people who upgrade and use current() a meaningful
message, we added this property with the warning message.

Please try to debug $records->toArray(), to see if some records are
fetched. If not, it's most probably a problem with your storage PID
settings. Could you post your TypoScript here?

Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list