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

eZ debug

Timing: Jan 31 2025 04:27:39
Script start
Timing: Jan 31 2025 04:27:39
Module start 'content'
Timing: Jan 31 2025 04:27:39
Module end 'content'
Timing: Jan 31 2025 04:27:39
Script end

Main resources:

Total runtime0.1244 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.1719180.8125
Module start 'content' 0.00580.0067 768.9844101.8516
Module end 'content' 0.01250.1118 870.8359530.6250
Script end 0.1243  1,401.4609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.6012200.0002
Check MTime0.00120.9924200.0001
Mysql Total
Database connection0.00070.590010.0007
Mysqli_queries0.082766.45961410.0006
Looping result0.00100.77841390.0000
Template Total0.111589.610.1115
Template load0.00080.681810.0008
Template processing0.110688.949710.1106
Override
Cache load0.00060.475210.0006
Sytem overhead
Fetch class attribute can translate value0.00070.578110.0007
XML
Image XML parsing0.00030.240410.0003
General
dbfile0.00635.0280200.0003
String conversion0.00000.004830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs