Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions docs/book/v5/migration/v4-to-v5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Migration from Version 4 to 5

## Changed Behavior & Signature Changes

### Final Classes and Inheritance

As a best practice, even if a hydrator (or other classes) is not marked as `final` in this library, extending it is discouraged — future major releases may prohibit inheritance altogether.
Prefer **composition over inheritance** by combining small, focused objects.
Use **decorators** to extend behavior without modifying original classes or creating deep inheritance chains.

### Hydrator Plugin Manager

#### Removal of legacy Zend aliases

All aliases that referenced the equivalent, legacy "Zend" hydrators have been removed. This means that an exception will be thrown if you attempt to retrieve a hydrator using one of these aliases such as `Zend\Hydrator\ArraySerializableHydrator::class`.

You will need to either update your codebase to use known aliases such as `Laminas\Hydrator\ArraySerializableHydrator::class`, or re-implement the aliases in your configuration.

### Removed Exceptions

The following exceptions have been removed:

- `Laminas\Hydrator\Exception\ExtensionNotLoadedException`
- `Laminas\Hydrator\Exception\InvalidCallbackException`
- `Laminas\Hydrator\Exception\LogicException`

### Changes of `Laminas\Hydrator\Strategy\SerializableStrategy`

- Simplified implementation.
- Internal getter and setter methods have been removed.
- If you're relying on these, update your code to use serialization logic externally or via injected services.

### Changes to Individual Hydrators

The following deprecated classes (since version 3.0.0) have been removed in version 5.
Please update your codebase to use the corresponding `*Hydrator` classes:

| Removed Class | Replacement Class |
|-------------------------------------------|----------------------------------------------------|
| `Laminas\Hydrator\ArraySerializable` | `Laminas\Hydrator\ArraySerializableHydrator` |
| `Laminas\Hydrator\ClassMethods` | `Laminas\Hydrator\ClassMethodsHydrator` |
| `Laminas\Hydrator\ObjectProperty` | `Laminas\Hydrator\ObjectPropertyHydrator` |
| `Laminas\Hydrator\Reflection` | `Laminas\Hydrator\ReflectionHydrator` |