Skip to content

Edm namespace cleanup

Choose a tag to compare

@mgerzabek mgerzabek released this 06 May 16:18
· 7 commits to main since this release

Note: this release is technically API-breaking (enum rename + interface relocations). It ships as a patch because all three current consumers (laravelui5/core, laravelui5/sdk, pragmatiqu/timesheet.biz) are in-house and patched in lock-step with the release. SemVer credit is spent here deliberately; a future release that crosses the public funnel boundary should bump the major.

Changed (breaking)

  • Renamed LaravelUi5\OData\Edm\Contracts\Container\PrimitiveTypeEnumLaravelUi5\OData\Edm\EdmPrimitiveType. The new name describes what the type is (the EDM primitive type) rather than what PHP shape it happens to take (an enum). Drops the dead Enum suffix; gains the Edm prefix shared with Edm.String, Edm.EnumType, etc. Lives flat under Edm\ because vocabulary enums are PHP vehicles, not contracts.
  • Relocated three type-level contracts misfiled under Edm\Contracts\Container\. CSDL §13 reserves EntityContainer for
    EntitySet, Singleton, ActionImport, FunctionImport only; type-level constructs are Schema-level peers of EntityContainer, not children of it. Moved:
    • Contracts\Container\PrimitiveTypeInterfaceContracts\Type\PrimitiveTypeInterface
    • Contracts\Container\EnumTypeInterfaceContracts\Type\EnumTypeInterface
    • Contracts\Container\EnumMemberInterfaceContracts\Type\EnumMemberInterface

After this move Edm\Contracts\Container\ is aligned with the CSDL §13 surface (Container children only) — symmetric with Edm\Container\ on the implementation side.

  • No deprecation alias is shipped. Consumers update use statements and PrimitiveTypeEnum::* references in the same release dance.

Migration

find <consumer-source-roots> -name '*.php' -exec sed -i '' \
    -e 's|LaravelUi5\\OData\\Edm\\Contracts\\Container\\PrimitiveTypeEnum|LaravelUi5\\OData\\Edm\\EdmPrimitiveType|g' \
    -e 's|LaravelUi5\\OData\\Edm\\Contracts\\Container\\PrimitiveTypeInterface|LaravelUi5\\OData\\Edm\\Contracts\\Type\\Primi
  tiveTypeInterface|g' \                                                                                                     
    -e 's|LaravelUi5\\OData\\Edm\\Contracts\\Container\\EnumTypeInterface|LaravelUi5\\OData\\Edm\\Contracts\\Type\\EnumTypeIn
  terface|g' \                                                                                                               
    -e 's|LaravelUi5\\OData\\Edm\\Contracts\\Container\\EnumMemberInterface|LaravelUi5\\OData\\Edm\\Contracts\\Type\\EnumMemb
  erInterface|g' \                                                                                                           
    -e 's|PrimitiveTypeEnum|EdmPrimitiveType|g' \           
    {} \;                                                                                                                    

Afterwards grep for PHP-escaped class-string literals — sed's single-backslash pattern misses 'LaravelUi5\OData\…' (double-backslash in source). The pattern that catches them:

grep -rn 'Contracts\\\\Container\\\\\(EdmPrimitiveType\|PrimitiveTypeInterface\|EnumTypeInterface\|EnumMemberInterface\)' <consumer-source-roots>