Project

General

Profile

Actions

Feature #3012

open

Test Streams_Stream->updateRelations()

Added by Gregory Magarshak over 1 year ago.

Status:
New
Priority:
High
Category:
Qbix Maintenance
Start date:
09/21/2023
Due date:
10/05/2023 (about 20 months late)
% Done:

0%

Estimated time:
2.00 h

Description

Sometimes you want to search for streams (products, profiles, etc.) based on their attributes, and for indexing we use relations. It would be nice to automate updating the relations when some attributes are updated, and that's what we implemented with Streams_Stream->updateRelations method. The Streams_Stream->afterSaveExecute method calls it, after it calls calculateAccess().

Now a developer is able to set config "Streams"/"types"/$type/"updateRelations": ["from"] which will make it so that updating some attributes on streams of that type will automatically update relations/indexes.

It will check what attributes changed, and then select from table Streams_RelatedFrom to find relations from the template named "$type/" published by either the stream's publisher, or by "" (all publishers on the server), that match those attributes. For every attribute name it finds, it will actually update the corresponding index by calling Streams::unrelate() with old values and Streams::relate() with new values.

Use breakpoints to test various things, including attributes that hold arrays of values, and fix any errors or corner cases you find. Then make a pull request in https://github.com/Qbix/Platform

This feature works only for the top-level of attributes, e.g. "Users/height", "Assets/price", rather than further down e.g. {"Assets": {"price": ...}}.

See https://qbix.com/platform/guide/relations for more info on how it works.

Anyway, your job is to test it.

No data to display

Actions

Also available in: Atom PDF