Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support of multiple sources in relation #3

Closed
Nayjest opened this issue Apr 14, 2017 · 2 comments
Closed

Implement support of multiple sources in relation #3

Nayjest opened this issue Apr 14, 2017 · 2 comments
Assignees

Comments

@Nayjest
Copy link
Owner

Nayjest commented Apr 14, 2017

Example:

new ComplexRelationDefinition(
    'target_id', 
    ['source1_id', 'source2_id'],
    function(&$taget, $source1, $source2) {
        &$target = $source1 + $source2;
    }
);
@Nayjest
Copy link
Owner Author

Nayjest commented Apr 14, 2017

Looks like example code equivalent to:

$hub->addDefinitions([
    new ItemDefinition('tmp', [null, null]),
    new RelationDefinition('tmp', 'source1_id', function (&$t, $s) {
        $t[0] = $s;
    }),
    new RelationDefinition('tmp', 'source2_id', function (&$t, $s) {
        $t[1] = $s2;
    }),
    new RelationDefinition('target_id', 'tmp', function (&$target, $tmp) {
        $t = $tmp[0] + $tmp[1];
    }),
]);

+ possibility to create private item definitions looks good here

$hub->addDefinition(
    new ItemDefinition('tmp', [null, null], ItemDefinitionm::FLAG_PRIVATE)
);
assert($hub->has('tmp') === false);

Nayjest added a commit that referenced this issue Apr 19, 2017
Nayjest added a commit that referenced this issue Apr 19, 2017
@Nayjest Nayjest self-assigned this Apr 20, 2017
@Nayjest Nayjest closed this as completed Apr 20, 2017
@Nayjest
Copy link
Owner Author

Nayjest commented Apr 20, 2017

Implemented in v0.5-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant