|
| 1 | +# Statamic v5.67.0 Compatibility Fix |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +This fix ensures compatibility with Statamic v5.67.0 where the `BlueprintRepository::$directory` property was changed to `BlueprintRepository::$directories`. The implementation maintains full backward compatibility with earlier versions. |
| 6 | + |
| 7 | +## Changes Made |
| 8 | + |
| 9 | +### 1. Updated `src/Repositories/BlueprintRepository.php` |
| 10 | + |
| 11 | +Added a new protected method `getDirectory()` that: |
| 12 | +- Checks for the new `directory()` method introduced in v5.67.0 (first priority) |
| 13 | +- Checks for the new `$directories` property (associative array with 'default' key) |
| 14 | +- Falls back to the old `$directory` property for pre-v5.67.0 compatibility |
| 15 | +- Provides a sensible default if none of the above are available |
| 16 | + |
| 17 | +Updated `makeBlueprintFromFile()` to use `getDirectory()` instead of directly accessing `$this->directory`. |
| 18 | + |
| 19 | +## Compatibility Matrix |
| 20 | + |
| 21 | +| Statamic Version | Property/Method | Status | |
| 22 | +|-----------------|-----------------|--------| |
| 23 | +| v5.0 - v5.66.x | `$directory` (string) | ✅ Supported | |
| 24 | +| v5.67.0+ | `$directories` (array) + `directory()` method | ✅ Supported | |
| 25 | + |
| 26 | +## Testing |
| 27 | + |
| 28 | +All compatibility scenarios have been tested: |
| 29 | + |
| 30 | +1. ✅ v5.67.0+ with `directory()` method |
| 31 | +2. ✅ v5.67.0+ accessing `$directories['default']` directly |
| 32 | +3. ✅ Pre-v5.67.0 with `$directory` property |
| 33 | +4. ✅ Simple array format (first element) |
| 34 | +5. ✅ Fallback to default when no properties set |
| 35 | +6. ✅ Empty directories array falls back to directory |
| 36 | +7. ✅ Multiple directories in associative array |
| 37 | +8. ✅ No PHP syntax errors |
| 38 | + |
| 39 | +Run the test suite: |
| 40 | +```bash |
| 41 | +php test-compatibility.php |
| 42 | +``` |
| 43 | + |
| 44 | +## Security |
| 45 | + |
| 46 | +CodeQL analysis performed - no security vulnerabilities detected. |
| 47 | + |
| 48 | +## Backward Compatibility |
| 49 | + |
| 50 | +This fix maintains full backward compatibility. No changes are required to existing code that uses this package. |
| 51 | + |
| 52 | +## References |
| 53 | + |
| 54 | +- Statamic CMS Issue: https://github.com/statamic/cms/blob/d4f75c67534712cef8fd7e185488a27dba3170da/src/Fields/BlueprintRepository.php#L21 |
| 55 | +- Original Issue: https://github.com/tdwesten/statamic-builder/blob/e39234b5eaec049e29085aae4187b54660477aea/src/Repositories/BlueprintRepository.php#L92 |
0 commit comments