Skip to content

Commit

Permalink
doc: add migration guide for 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Aug 16, 2020
1 parent b817946 commit 160386e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 228 deletions.
3 changes: 1 addition & 2 deletions doc/menu.texy
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Tutorials: .[h4]

- [Embeddables | embeddables]
- [UniqueConstraint | unique-constraint]
- [Migration to 3.0 | migrate_3.0]
- [Migration to 2.0 | migrate_2.0]
- [Migration to 4.0 | migrate_4.0]
163 changes: 0 additions & 163 deletions doc/migrate_2.0.texy

This file was deleted.

63 changes: 0 additions & 63 deletions doc/migrate_3.0.texy

This file was deleted.

45 changes: 45 additions & 0 deletions doc/migrate_4.0.texy
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Migration Guide for 4.0
#######################

We evaluate here only BC breaks you will probably encounter. This major version consists also of other minor BC breaks which are quite internal, i.e. the probability you don't use these semi-public API is quite high.

- **required PHP 7.1 and new types**
We have added scalar types to Orm interfaces; Some of you implementations have to be updated;
- **Removed BaseMapper & Collection**
These classes were just pure aliases. Use specific implementations (DbalMapper / DbalCollection) directly.
- **StorageReflection renamed to Conventions**
We have renamed StorageReflection classes to Conventions. New name better covers what these classes do. Also, the property name changes from underscored to pascal-cased is handled by inflector class, not by inheritance anymore.
/--php
class BooksMapper extends DbalMapper
{
// change inflection from SnakeCaseInflector
protected function createInflector(): IInflector
{
return new CamelCaseInflector();
}

// add mapping
protected function createConventions(): IConventions
{
$conventions = parent::createConventions();
$conventions->setMapping('price->cents', 'price');
return $conventions;
}
}
\--
- **Collection namespace restructured**
ArrayCollection and DbalCollection moved to Collection sub-namespace; helper classes moved and renamed;
- **Collection: reworked custom collection functions**
Custom functions have been completely reworked and simplified, see [docs | collection-functions] what they can do now and how to write them.
- **Collection: removed `this->` prefix for relationship traversals**
Relationship traversal newly does not require putting `this->` prefix in collection filtering expression.
/--php
$booksCollection->findBy(['this->author->name' => 'John']);
// after
$booksCollection->findBy(['author->name' => 'John']);
\--
- **Entity: renamed property containers to property wrappers**
This is purely naming change when property containers are called wrappers. Use new `{wrapper YourClass}` modifier.
- **Entity: ImmutableValuePropertyContainer was reworked**
ImmutableValuePropertyContainer - a helper for property wrapper was reworked and renamed to ImmutableValuePropertyWrapper.
Change contains renamed APIs, wrapper does not depend on entity, and doesn't handle null for you, i.e. you can have now easily nullable property wrapper.

0 comments on commit 160386e

Please sign in to comment.