Forums / Developer / How to set a default value for a large number of objects?
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 version3. 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