Forums / Setup & design / Class attribute datatype convertion without data loss

Class attribute datatype convertion without data loss

Author Message

Piotrek Karaś

Tuesday 25 July 2006 5:35:55 am

Is it possible to convert custom class' attribute's datatype to another (similar) without loosing the data inserted (as object attributes) before this convertion and with all the existing attributes being converted?

Example: I have a simple custom class with only one attribute "my_description" which is of XML block type. After creating say 10 objects, I discover, that I don't need XML block after all and Text block would be just enough and even more convenient (no tags were ever used). Is it possible to convert the "my_description" attribute to a Text block without loosing the values of the existing 10 objects, so that when I edit one of them, it's available through classic textarea instead of OnlineEditor and data is all there?

Any help would be appreciated.

PS. This is my first post, 2 weeks of intensive eZpublish experience so far, hello to everyone :)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Mark Marsiglio

Tuesday 25 July 2006 6:18:39 am

With only 10 objects, I think the easiest way to accomplish this would be to add the text block, copy and paste each object's XML Block into the text block, then remove the XML block.

As an aside though, it might be a good idea to leave it as an XML block, even if you don't think you will need it now. The problem might be turned around in the future when it would be harder to convert it back.

There is little downside to using an XML block vs. a Text block that I know of.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Piotrek Karaś

Tuesday 25 July 2006 9:25:10 am

After your suggestions (which I find both true and valuable by the way) as well as few experiments of my own, I'm starting to face the fact, than planning would be everything in custom class use and eZ isn't as flexible as I thought (even though it is still far more than I have ever expected before I started using it) :)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Kristof Coomans

Tuesday 25 July 2006 10:33:13 am

Hi guys

This is not a standard feature of eZ publish, but some time ago I've made an extension with a GUI for datatype conversions. It uses a plugin system, so every possible datatype-to-datatype conversion can be supported. The quality of the conversion depends on the plugin.

You can download a first alpha release at http://ez.no/community/contribs/datatypes/datatypes.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Piotrek Karaś

Tuesday 25 July 2006 12:14:37 pm

I will definitely give it a try (despite the highly experimental notice ;). Thanks a lot.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu