Podius::Persistence::ComponentPropertyMap - maps component properties to table fields
use Podius; use Podius::Persistence::ComponentPropertyMap; use Podius::ComponentClasses; use Data::NeatDump;
my $map = new Podius::Persistence::ComponentPropertyMap;
print_data_dump($map->prepare_pm_retrieve_component_data('Section'));
print_data_dump($map->get_create_tables_data(@Podius::ComponentClasses::LIST));
Defines standardized component mapping interface for persistence media(s)
and provides default mapping.
Supports primary Persistence Media (table mapping) and secondary RawData Persistence Media (file mapping).
$table_name_prefix - string
$use_c_table_name_prefix - boolean
$property_type_map - HASH { (property_type => property_map_entry)* }
$property_name_map - HASH { ('c_type:p_name' => property_map_entry)* }
$property_type_aliases - HASH { (property_type1 => property_type2)* }
$property_name_aliases - HASH { ('c_type:p_name1'=>'c_type:p_name2')* }
$inheritance_map - [ name, [ <super_type,id,real_type>_field_entry ] ]
$high_key_map - [ name, [ <super_type,last_value>_field_entry ] ]
$key_field_entry - <id>_field_entry == [ name, type, search-type ]
$revision_field_entry - <revision>_f_e == [ name, type, search-type ]
the Exception manpage, the Debug manpage, the Podius::Component manpage.
insert, update) methods for
given component.
* component - instance of Podius::Component subclass * flag - 0: save all properties (default), 1: update only modified
[
# the commented in array included only when flag == 1
# [ [ unmodified_field* ], [ unmodified_add_table_property* ] ],
[ [ field, ftype, value ]* ],
[ add_table,
[ [ kfield, kvalue ]* ],
[ [ rfield, rvalue ]* ],
[ [ lfield, [ lvalue* ] ]* ]
]*
], [
[ [ field, value ]* ],
]
retrieve method for given component type.
* concrete component type * property names to retrieve
[
[ [ field, ftype ]* ],
[ add_table, [ ifield, [ cfield, cvalue ]* ],
[ rfield* ], [ lfield* ] ]*
], [
[ field* ],
]
* component
* two array of arrays (for primary and secondary PM), as described here:
[
[ value* ],
[ [ rvalue* ], [ [ lvalue* ]* ] ]*
], [
[ value* ],
]
* property names to retrieve
delete method for given component type.
* concrete component type * component id to delete (not used)
[
[ add_table, [ ifield, [ cfield, cvalue ]* ] ]*
], [
]
find_keys method for given component type.
* component type (may be abstract) * query object
{
name => type,
}
where type may be 0 (unknown), 1 (regular field), [ 2, delim ] (joined list).
Scalar, as component table name, if the argument was scalar.
Scalar, as component type, if the argument was scalar.
* array ref of scalars, representing component classes, we want to create tables for them * flag: 1 - don't include special tables, like inheritance, high_key etc.
[
[ table, [ [ field, type, searchable ]* ] ]*
]
[
table-name, [
supertype-field-name,
id-field-name,
realtype-field-name,
]
]
[
table-name, [
supertype-field-name,
value-field-name,
]
]