Skip to content

Add Doctrine DBAL 4 and Persistence 4 compatibility#135

Open
ireneperezddc1 wants to merge 5 commits into
symfony:mainfrom
ireneperezddc1:feature/dbal4-compatibility
Open

Add Doctrine DBAL 4 and Persistence 4 compatibility#135
ireneperezddc1 wants to merge 5 commits into
symfony:mainfrom
ireneperezddc1:feature/dbal4-compatibility

Conversation

@ireneperezddc1

Copy link
Copy Markdown

This commit adds support for doctrine/dbal ^4 and doctrine/persistence ^4.

Changes:

  • Updated composer.json to allow doctrine/dbal ^4 and doctrine/persistence ^4
  • Added required return type annotations : void to methods implementing interfaces from doctrine/persistence 4:
    • MutableAclProvider::propertyChanged() (implements PropertyChangedListener interface)
    • Acl::addPropertyChangedListener() (implements NotifyPropertyChanged interface)
  • Fixed foreign key constraints in Schema.php to use table names instead of Table objects (DBAL 4 requirement)

Note: The return type annotations are now required (not optional) because the interfaces in doctrine/persistence 4 have these return types defined. Without them, PHP will throw a fatal error about incompatible method signatures.

Irene Pérez added 2 commits March 13, 2026 10:16
This commit adds support for doctrine/dbal ^4 and doctrine/persistence ^4.

Changes:
- Updated composer.json to allow doctrine/dbal ^4 and doctrine/persistence ^4
- Added required return type annotations `: void` to methods implementing interfaces from doctrine/persistence 4:
  - MutableAclProvider::propertyChanged() (implements PropertyChangedListener interface)
  - Acl::addPropertyChangedListener() (implements NotifyPropertyChanged interface)
- Fixed foreign key constraints in Schema.php to use table names instead of Table objects (DBAL 4 requirement)

Note: The return type annotations are now required (not optional) because the interfaces in doctrine/persistence 4 have these return types defined. Without them, PHP will throw a fatal error about incompatible method signatures.
Irene Pérez added 3 commits March 13, 2026 13:02
…raints

This commit refactors the handling of primary keys and foreign key constraints in `Dbal/Schema.php` to ensure compatibility with both Doctrine DBAL 3 and 4. Adjustments include conditional logic to handle differences in method availability and schema construction.
* @throws \InvalidArgumentException
*/
public function propertyChanged($sender, $propertyName, $oldValue, $newValue)
public function propertyChanged($sender, $propertyName, $oldValue, $newValue): void

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the function fails because of new propertyChanged definition

Comment thread Domain/Acl.php
* @return void
*/
public function addPropertyChangedListener(PropertyChangedListener $listener)
public function addPropertyChangedListener(PropertyChangedListener $listener): void

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without returning type, the function fails because of new NotifyPropertyChanged definition

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.

1 participant