How to set a default value for a large number of objects?

Author Message

Massimiliano Bariola

Friday 13 January 2006 8:47:22 am

hi,

a question which I think is rather staple but never tried it before:

Let's assume I have a large numbers of objects of a certain class (say 1500). then I need to add a new attribute to this class.

As far as I know, all __old__ objects get this new attribute, but it is not initialized to any "default value". Instead, the default value is dependent on the attribute's datatype.

Question: how do I set the default value for the new attribute in all old objects ?

PHP script?
some kind of (infernal :-) ) workflow?
admin functionality that I don't know ?
an unknown eZ update script?
Any ideas? :-)

TIA,

M.B.

Norman Leutner

Sunday 15 January 2006 1:23:43 am

I would write a small extension which updates all you class objects.

All the script has to do is:

1. Create new object version
2. Store that version
3. Publish the new object version

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

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 18 2025 19:37:28
Script start
Timing: Jan 18 2025 19:37:28
Module start 'layout'
Timing: Jan 18 2025 19:37:28
Module start 'content'
Timing: Jan 18 2025 19:37:28
Module end 'content'
Timing: Jan 18 2025 19:37:28
Script end

Main resources:

Total runtime0.0136 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 593.8203152.6563
Module start 'layout' 0.00530.0026 746.476639.5078
Module start 'content' 0.00790.0039 785.984489.3984
Module end 'content' 0.01180.0018 875.382830.3047
Script end 0.0136  905.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002618.9109140.0002
Check MTime0.00107.5398140.0001
Mysql Total
Database connection0.00075.506910.0007
Mysqli_queries0.002115.781830.0007
Looping result0.00000.059510.0000
Template Total0.001510.910.0015
Template load0.00096.741410.0009
Template processing0.00064.120110.0006
Override
Cache load0.00074.897610.0007
General
dbfile0.00021.738780.0000
String conversion0.00000.045540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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