Skip to content

Allow properties mapping in reflected names #125

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

Merged
merged 1 commit into from
Jul 13, 2021
Merged

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Jul 13, 2021

Resolves #124.

This PR upgrades names reflector with properties mappings, so that it is possible to use mapped names in further schema configuration.

Example:

        // Define default mapping if any.
        $ownerSchema->addPropertyMapping('date_time', Order::names()->dateTime);

        // Use mapped name references after the default mapping was configured.
        $names = self::names($ownerSchema->properties);
        $ownerSchema->required = array(
            $names->id,         
            $names->dateTime, // "date_time"
            $names->price       
        );

@github-actions
Copy link

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Markdown 2 602 (+8) 473 (+7) 0 129 (+1) 0 19.4K (+271B)
PHP 133 11088 (+22) 8021 (+12) 1473 (+5) 1594 (+5) 556 (+3) 320.3K (+675B)

@codecov
Copy link

codecov bot commented Jul 13, 2021

Codecov Report

Merging #125 (aeac3b7) into master (d0126bd) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head aeac3b7 differs from pull request most recent head 54957e0. Consider uploading reports for the commit 54957e0 to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##             master     #125      +/-   ##
============================================
+ Coverage     92.34%   92.36%   +0.02%     
- Complexity      756      760       +4     
============================================
  Files            27       27              
  Lines          1645     1651       +6     
============================================
+ Hits           1519     1525       +6     
  Misses          126      126              
Impacted Files Coverage Δ
src/NameMirror.php 75.00% <100.00%> (+25.00%) ⬆️
src/Structure/ClassStructureTrait.php 95.83% <100.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0126bd...54957e0. Read the comment docs.

@vearutop vearutop merged commit d99c0ad into master Jul 13, 2021
@vearutop vearutop deleted the mapped-names branch July 13, 2021 22:19
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

Successfully merging this pull request may close these issues.

Schema->processObjectRequired() does not handle property mappings
1 participant