phpsqltypo3extbaseoperands

TYPO3 Extbase: Operand should contain 1 column(s):


i want to add() a message to the database in my controller. That works so far.

I've got a column called "message_tags" in which i save an array.

The array is:

array(5 items)
0 => 'dfsdfsd' (7 chars)
1 => 'dsfsdf' (6 chars)
2 => 'sdfdsf' (6 chars)
3 => 'asd' (3 chars)
4 => 'google' (6 chars)

Now, TYPO3 throws me an error:

Operand should contain 1 column(s): UPDATE   
tx_xxx_domain_model_message SET message_text='dfdsfsdf', 
message_tags=('dfsdfsd','dsfsdf','sdfdsf','asd','google'), mobile_os=('android'), 
tstamp='1355846301', sys_language_uid=NULL WHERE uid='73'

The array is constructed in my controller (i know this is far away from good coding):

foreach($messageTagsArray as $key => $value) {
              $mergedTagArrayValues[] = $value;
            }
            foreach($storedTagsList as $key => $value) {
              $storedTagsListValues[] = $value;
            }
            $mergedTagArray = array_merge($mergedTagArrayValues, $storedTagsListValues);
            $mergedTagArray = array_unique($mergedTagArray);

            $message->setMessageTags($mergedTagArray);

Is that a bug?

Thanks for your help!

Best regards


Solution

  • TYPO3 apparently is trying to use your array as a part of the query, which fails.

    Fastest workaround for this will be just serializing the array in your setter (setMessageTags($array)) and unserializing in the getter (getMessageTags()) in such case Extbase will save it as a string, however you'll keep possibility to work with array without any additional steps.