The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Interchange6::Schema::Base::Attribute

DESCRIPTION

This Base class in intended to be added to classes that require attributes examples of these classes include User, Navigation and Product.

Assumptions

This module assumes that your using standardized class naming.

example: User in this example is the $base class so UserAttribute, UserAttributeValue class naming would be used. These would also use user_attributes_id and user_attributes_values_id as primary keys. In general follow the example classes listed in description.

SYNOPSIS

    $navigation_object->add_attribute('meta_title','My very seductive title here!');

METHODS

add_attribute

Add attribute.

$base->add_attribute('hair_color', 'blond');

Where 'hair_color' is Attribute and 'blond' is AttributeValue

update_attribute_value

Update base attribute value

$base->update_attribute('hair_color', 'brown');

delete_attribute

Delete $base attribute

$base->delete_attribute('hair_color', 'purple');

search_attributes

Returns attributes for a $base object

my $attr_rs = shop_product->find('WBA0001')->search_attributes;

find_attribute_value

Finds the attribute value for the current object or a defined object value. If $object is passed the entire attribute_value object will be returned. $args can accept both scaler and hash inputs.

$base->find_attribute_value({name => $attr_name, priority => $attr_priority}, {object => 1});

find_or_create_attribute

Find or create attribute and attribute_value.

find_base_attribute_value

From a $base->attribute input $base_attribute, $base_attribute_value is returned.