Forums / Developer / Attribute class automatically fill when object is created

Attribute class automatically fill when object is created

Author Message

Albert Balagueró

Monday 18 July 2011 6:08:36 am

Hi,
I would like to know if is it possible that when user creates a new object of a class, this object gets the value of a class attribute automatically. I mean: the user creates an object that have "number" attribute, "title" attribute and "descripction" attribute, is there a way to give the object's "number" attribute automatically a value? The first created, must be 001 (for example), the second, 002; the third, 003; this attribute will increase +1 at each new creation...
Thaks. 

Damien Pobel

Monday 18 July 2011 6:24:17 am

Hi Albert,

If you just want to increment an attribute on each object creation you can add an identifier attribute to your content class and eZ Publish will do the rest automagically ;-)

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Albert Balagueró

Monday 18 July 2011 6:36:04 am

Hi Damien,
I am ashamed, it was so simple... I didn't know ant test either this class attribute.

Thank you for your fast response.
Cheers!