<<

NAME

Koha::Objects::Mixin::ExtendedAttributes

Class methods

search

    Overwrites the search method to include extended attributes rewrite and dynamic relation accessors

handle_query_extended_attributes

    Checks for the presence of extended_attributes in a query
    If present, it builds the dynamic extended attributes relations and rewrites the query to include the extended_attributes relation

_get_extended_attributes_entries

    $self->_get_extended_attributes_entries( $filtered_params, 0 )

Recursive function that returns the rewritten extended_attributes query entries.

Given: [ '-and', [ { 'extended_attributes.code' => 'CODE_1', 'extended_attributes.attribute' => { 'like' => '%Bar%' } }, { 'extended_attributes.attribute' => { 'like' => '%Bar%' }, 'extended_attributes.code' => 'CODE_2' } ] ];

Returns :

[ 'CODE_1', 'CODE_2' ]

_rewrite_related_metadata_query

        $extended_attributes_entries =
            _rewrite_related_metadata_query( $params, 'field_id', 'value', @array )

Helper function that rewrites all subsequent extended_attributes queries to match the alias generated by the dbic self left join Take the below example (patrons): [ { "extended_attributes.attribute":{"like":"%123%"}, "extended_attributes.code":"CODE_1" } ], [ { "extended_attributes.attribute":{"like":"%abc%" }, "extended_attributes.code":"CODE_2" } ]

It'll be rewritten as: [ { 'extended_attributes_CODE_1.attribute' => { 'like' => '%123%' }, 'extended_attributes_CODE_1.code' => 'CODE_1' } ], [ { 'extended_attributes_CODE_2.attribute' => { 'like' => '%abc%' }, 'extended_attributes_CODE_2.code' => 'CODE_2' } ]

_build_extended_attributes_relations

    Method to dynamically add has_many relations for Koha classes that support extended_attributes.

    Returns a list of relation accessor names.

<<