NAME
Elive::Struct - Base class for Elive::Entity and entity sub-structures
DESCRIPTION
Base class for sub-structures within entities, eg Elive::Entity::Role. This is also used as a base class for Elive::Entity.
METHODS
stringify
Return a human readable string representation of an object. For database entities, this is the primary key:
if ($user_obj->stringify eq "11223344") {
....
}
Arrays of sub-items evaluated, in a string context, to a semi-colon separated string of the individual values sorted.
my $group = Elive::Entity::Group->retrieve([98765]);
if ($group->members->stringify eq "11223344;2222222") {
....
}
In particular meeting participants stringify to userId=role, eg
my $participant_list = Elive::Entity::ParticipantList->retrieve([98765]);
if ($participant_list->participants->stringify eq "11223344=3;2222222=2") {
....
}
entity_name
my $entity_name = MyApp::Entity::User->entity_name
ok($entity_name eq 'user');
collection_name
my $collection_name = MyApp::Entity::User->collecion_name
ok($collection_name eq 'users');
id
my @primary_vals = $entity_obj->id
Return primary key values.
primary_key
Setter/getter for primary key field(s) for this entity class
my @pkey = MyApp::Entity::User->primary_key
params
Setter/getter for parameter field(s) for this entity class
Elive::Entity::User->params(loginName => 'Str');
my %params = MyApp::Entity::User->params;
derivable
Setter/getter for derivable field(s) for this entity class
entities
my $entities = Entity::Entity->entities
print "user has entity class: $entities->{user}\n";
print "meetingParticipant entity class has not been loaded\n"
unless ($entities->{meetingParticipant});
Return has hash ref of all loaded entity names and classes
properties
my @properties = MyApp::Entity::User->properties;
Return the property accessor names for an entity
property_types
my $user_types = MyApp::Entity::User->property_types;
my ($type,
$is_array,
$is_struct) = Elive::Util::parse_type($user_types->{role})
Return a hashref of attribute data types.
property_doco
my $user_doc = MyApp::Entity::User->property_doc
my $user_password_doco = $user_doc->{loginPassword}
Return a hashref of documentation for properties
set
$obj->set(prop1 => val1, prop2 => val2 [,...])
Assign values to entity properties.