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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 06:29:46
Script start
Timing: Jan 31 2025 06:29:46
Module start 'layout'
Timing: Jan 31 2025 06:29:46
Module start 'content'
Timing: Jan 31 2025 06:29:47
Module end 'content'
Timing: Jan 31 2025 06:29:47
Script end

Main resources:

Total runtime0.9986 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.3750151.2422
Module start 'layout' 0.00580.0031 739.617236.7109
Module start 'content' 0.00890.9886 776.32811,007.0938
Module end 'content' 0.99750.0011 1,783.421916.1094
Script end 0.9986  1,799.5313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2980160.0002
Check MTime0.00130.1287160.0001
Mysql Total
Database connection0.00090.089510.0009
Mysqli_queries0.935893.7076650.0144
Looping result0.00070.0698630.0000
Template Total0.963596.520.4818
Template load0.00190.195120.0010
Template processing0.961696.287820.4808
Template load and register function0.00140.142410.0014
states
state_id_array0.00120.116410.0012
state_identifier_array0.00190.186720.0009
Override
Cache load0.00160.1594240.0001
Sytem overhead
Fetch class attribute can translate value0.00050.053630.0002
Fetch class attribute name0.00300.300780.0004
XML
Image XML parsing0.00150.152730.0005
class_abstraction
Instantiating content class attribute0.00000.0022100.0000
General
dbfile0.00210.2068280.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs