I need to provide a guarantee for uniqueness for a column in entities of Object type and customer subtype for example .An example of "uniqueness for a column" is the username in User entities.
What's the best practice to implement the feature of unique value in Object entities ?
Thank you very much.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Dries@driesdk
Dries - 0 likes
- bilel@bilel.elgg
bilel - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- Team Webgalli@webgalli
Team Webgalli - 0 likes
- bilel@bilel.elgg
bilel - 0 likes
- id_card(identity card that is unique in Client entities)
- age
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- bilel@bilel.elgg
bilel - 0 likes
You must log in to post replies.The entity guid?
No another attribute of Object entity as username in User entity (username != guid) and username is unique in User entities.
GUID which stands for Global Unique IDentifier ;)
use GUID value.
An exemple:
Client (subtype client, type Object)
Client has 2 attributes:
In creation form of client entity ,How to avoid create another client with the same id_card ?
Which the best practice used by Elgg for this situation ?
in your save action
$count = elgg_get_entities_from_metadata(array(
'type' => 'object',
'subtype' => 'client',
'metadata_name_value_pairs' => array('id_card' => $submitted_value),
'count' => true));
if ($count) {
report failure and return to form
}
Thank you very much for the prompt reply.