Skip to content

Conversation

@emmadesilva
Copy link
Member

@emmadesilva emmadesilva commented Feb 19, 2024

This is part of HydePHP v2.x via #1568

A breaking change here is that the NavItem properties are no longer public. Instead they must be used through (already existing) accessors. While this adds extra boilerplate and inconvenience, it also allows us to open up the class data to being edited, the reason we protect the properties is so that we can control the data being added for a consistent and predictable state.

How to upgrade:

Simply replace any usage where you manually called a property with its accessor. (see the file diff for an example)

use Hyde\Framework\Features\Navigation\NavItem;

$item = new NavItem();

$item->destination => $item->getDestination(); 
$item->label => $item->getLabel(); 
$item->priority => $item->getPriority(); 
$item->group => $item->getGroup(); 
$item->children => $item->getChildren(); 

@codecov
Copy link

codecov bot commented Feb 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b018e7d) 100.00% compared to head (482ac8a) 100.00%.

Additional details and impacted files
@@                        Coverage Diff                        @@
##             improved-navigation-internals     #1574   +/-   ##
=================================================================
  Coverage                           100.00%   100.00%           
- Complexity                            1761      1762    +1     
=================================================================
  Files                                  184       184           
  Lines                                 4767      4769    +2     
=================================================================
+ Hits                                  4767      4769    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@emmadesilva emmadesilva force-pushed the change-navitem-class-api-to-be-fluent-instead-of-readonly branch from 9a8a5c6 to 5fa2bb2 Compare February 19, 2024 13:37
@emmadesilva emmadesilva force-pushed the change-navitem-class-api-to-be-fluent-instead-of-readonly branch from c7800e5 to d51186d Compare February 19, 2024 14:35
@emmadesilva emmadesilva marked this pull request as ready for review February 19, 2024 14:48
@emmadesilva emmadesilva merged commit 35c1400 into improved-navigation-internals Feb 19, 2024
@emmadesilva emmadesilva deleted the change-navitem-class-api-to-be-fluent-instead-of-readonly branch February 19, 2024 14:54
@emmadesilva emmadesilva added this to the v2 milestone Jul 9, 2024
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.

2 participants