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

API for transformation rules building #3

Open
pawaclawczyk opened this issue Feb 17, 2013 · 2 comments
Open

API for transformation rules building #3

pawaclawczyk opened this issue Feb 17, 2013 · 2 comments
Milestone

Comments

@pawaclawczyk
Copy link
Owner

Proposition of API to build set of rules using in transformation

RuleSetBuilder
    ::create()
        ::from(SourceProperty)
            ::within(SourceObject)
        ::using(Filter)
            ::on(SourceProperty)
        ::to(TargetProperty)
            ::within(TargetObject)
    ::build()
@pawaclawczyk
Copy link
Owner Author

$rsb
    ->from(array('firstName', 'lastName'))
        ->within($person)
    ->using(function ($firstName, $lastName) { return sprintf("%s %s", $firstName, $lastName); })
        ->on(array('firstName', 'lastName'))
    ->to('fullName')
        ->within($contact);
    ->from('phoneNumber')
        ->within($person)
    ->to('phoneNumber')
        ->within($contact)
    ->build()

@krymen
Copy link
Contributor

krymen commented Feb 17, 2013

Below indentation is more legible:

$rsb
    ->from(array('firstName', 'lastName'))->within($person)
        ->using(function ($firstName, $lastName) { return sprintf("%s %s", $firstName, $lastName); })
        ->on(array('firstName', 'lastName'))
    ->to('fullName')->within($contact);
    ->from('phoneNumber')->within($person)
    ->to('phoneNumber')->within($contact)
    ->build()

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

2 participants