Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPORM-289 Support Laravel 12 #3283

Merged
merged 10 commits into from
Mar 1, 2025
Merged

PHPORM-289 Support Laravel 12 #3283

merged 10 commits into from
Mar 1, 2025

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Feb 19, 2025

Fix PHPORM-289

Replace #3278
Closes #3288

Needed:

Breaking changes

@GromNaN GromNaN requested a review from a team as a code owner February 19, 2025 11:14
@GromNaN GromNaN requested a review from jmikola February 19, 2025 11:14
@GromNaN GromNaN added this to the 5.2 milestone Feb 19, 2025
@GromNaN GromNaN marked this pull request as draft February 19, 2025 13:27
@GromNaN GromNaN removed the request for review from jmikola February 19, 2025 13:27
@GromNaN GromNaN marked this pull request as ready for review February 24, 2025 20:44
Comment on lines -37 to -40
- php: "8.4"
laravel: "11.*"
mongodb: "7.0"
os: "ubuntu-latest"
Copy link
Member Author

Choose a reason for hiding this comment

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

This was duplicating an existing case.

Comment on lines +3 to +12
-
message: "#^Class MongoDB\\\\Laravel\\\\Query\\\\Grammar does not have a constructor and must be instantiated without any parameters\\.$#"
count: 1
path: src/Connection.php

-
message: "#^Class MongoDB\\\\Laravel\\\\Schema\\\\Grammar does not have a constructor and must be instantiated without any parameters\\.$#"
count: 1
path: src/Connection.php

Copy link
Member Author

Choose a reason for hiding this comment

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

It tried using the @phpstan-ignore new.noConstructor in the code, but that triggers an other error ignore.unmatchedIdentifier on Laravel 12, where the constructor has this parameter.

Comment on lines +348 to +366
// Argument added in Laravel 12
return new Query\Grammar($this);
}

/** @inheritdoc */
protected function getDefaultSchemaGrammar()
{
return new Schema\Grammar();
// Argument added in Laravel 12
return new Schema\Grammar($this);
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -35,6 +35,7 @@ public function tearDown(): void
Photo::truncate();
Label::truncate();
Skill::truncate();
Soft::truncate();
Copy link
Member Author

Choose a reason for hiding this comment

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

This was a latent bug when the test suite was run in a particular order, MassPrunableTest::testPruneSoftDelete failed.

@@ -137,9 +142,10 @@ public function dropAllTables()
}
}

public function getTables()
/** @param string|null $schema Database name */
public function getTables($schema = null)
Copy link
Member

Choose a reason for hiding this comment

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

Are the signature changes here also a potential BC break for Laravel 11 users, or would you not expect anyone to extend this class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this is a breaking change if someone extends our class... I hope nobody does. We should make more classes final.

$collections = array_map(fn ($db, $collections) => array_map(static fn ($collection) => $db . '.' . $collection, $collections), array_keys($collections), $collections);
}

$collections = array_merge(...array_values($collections));
Copy link
Member

Choose a reason for hiding this comment

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

If $schemaQualified is false and the database name is never prepended to yield full namespaces, would this statement potentially clobber collection names?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but that's how the feature is designed.

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

LGTM, as I'm not sure what else would need to be done here; however, you may want to consider whether these BC breaks warrant a major version bump.

@marlonbasten
Copy link

@jmikola So what's the holdup here? 😅

@BlackOrder
Copy link

this build need the update of mongodb. but it's a breaking change because it needs: pecl install mongodb

…efined ccompatible with each Laravel version
@GromNaN GromNaN merged commit e373350 into mongodb:5.x Mar 1, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Laravel 12 Support
4 participants