Forums / General / Unique compound key for a class
Arlan Hair
Tuesday 22 November 2005 1:55:09 pm
What is the best way of creating a new class that requires a unique compound key.
Example <b>Attribute</b>.......Key field Project...........yes Year..............yesMoreInfo..........no
where there can only be one object that contains a given Project, Year.
Ćukasz Serwatka
Wednesday 23 November 2005 11:40:50 pm
Hi Arlan,
You can us Identifier datatype as unique attribute, it will be unique around objects created from class which has this attribute.
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Monday 28 November 2005 7:34:49 am
Thanks Lukasz, I need to clarify my request a little more. I am from the relational database era where you can specify a unique key over several fields (attributes) that will be entered by the user. In the example below I do not what to allow the user to add a second record with project=5100, Year=2005. Existing objects Project Year MoreInfo 5100 2003 los lorum... 5200 2003 qwert... 5100 2004 qwert... 5200 2004 qwert... 5100 2005 qwert...My understanding of the Identifier datatype is an auto incremental number surrounded by hard coded text.