Share » Forums » Developer » Versioning when adding content class...

Versioning when adding content class attribute from PHP

Versioning when adding content class attribute from PHP

Friday 15 April 2011 4:19:16 am - 3 replies

Modified on Friday 15 April 2011 4:23:16 am by Eirik Alfstad Johansen

Author Message

Edi Modrić

Friday 15 April 2011 7:59:37 am

Hi Eirik,

When adding class attribute through PHP, you also need to manually add the instance of that attribute to all of the existing objects manually.

There is a nice PHP script, addmissingobjectattributes.php, that does exactly that, so you can check it out.

It is located at:

https://github.com/ezsystems/ezscriptmonitor/blob/master/bin/addmissingobjectattributes.php

eZ Publish certified developer

http://ez.no/certification/verify/350658

Eirik Alfstad Johansen

Monday 25 April 2011 11:45:08 pm

Hi Edi,

Thanks a bunch. I was not aware of this.

However, I'm curious as to whether this happens automatically when an attribute is added through the admin interface, as this seems to be the case.

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Edi Modrić

Tuesday 26 April 2011 12:32:35 am

Hi Eirik,

yes, admin interface does it automatically when you add new attributes to content classes.

The reason for mentioned script existance is that if there are many objects of the specific class, the operation of saving the class can be very long process which can timeout and leave the database inconsistent. The script works around this by using a stored draft of the class and running through the objects adding/removing attributes as needed.

eZ Publish certified developer

http://ez.no/certification/verify/350658

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu