Forums / Developer / $contentObjectAttribute attributes

$contentObjectAttribute attributes

Author Message

Ivan Švogor

Thursday 14 October 2010 7:50:23 am

Hello,

I want to ask about setting attributes in datatypes. In method fetchObjectAttributeHTTPInput, i use $contentObjectAttribute->setAttribute("data_text", $data);

I want to ask about this "data_text". What is this? - what if I want to set multiple "texts". With this I can transfer only one value (unless I use some kind of separator). Where can I find some reference of this method?

Ivo Lukac

Thursday 14 October 2010 9:16:56 am

Hi Ivan,

eZ attributes table in database has only trivial storage capabilities: data_text field, data_int field, data_float field, etc.

For more complex cases you can use delimiters (as you self suggested) , code it in xml (like ezxmltext or ezmatrix) or use other tables (like ezkeyword).

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Ivan Švogor

Thursday 14 October 2010 10:30:25 am

Bok Ivo, so we meet again :)

Hmm.. That isn't so pactical, but XML saves the day ..

It seems that NetGen is pretty active in this forum. Thank you for your answer.

Marko Žmak

Thursday 14 October 2010 2:45:56 pm

Hi Ivan, just a note...

For even more complex datatypes, you can create your own table in the database, store all the data there, and relate it with a foreign key to the attribute. Of course you'll have to write your own code for storing and retreiving data.

For example, that's how the ezcomments extension works.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Ivo Lukac

Friday 15 October 2010 12:30:57 am

"

Bok Ivo, so we meet again :)

Hmm.. That isn't so pactical, but XML saves the day ..

It seems that NetGen is pretty active in this forum. Thank you for your answer.

"

If you don't need to filter the data with SQL use XML...

YACT (yet another Croatian thread)

;)

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Gaetano Giunta

Friday 15 October 2010 12:40:31 am

 If you don't need to filter the data with SQL use XML...

And if you do not need attributes besides elements use JSON! ;-)

Principal Consultant International Business
Member of the Community Project Board