From 249535c559c8a6c8e5cec5d7989b53373ba78fdb Mon Sep 17 00:00:00 2001 From: norareidy Date: Wed, 6 Mar 2024 16:08:53 -0500 Subject: [PATCH 1/8] DOCSP-35933: Upgrade version guide --- docs/upgrade.txt | 66 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/docs/upgrade.txt b/docs/upgrade.txt index 8148fbdfc..9276d6d28 100644 --- a/docs/upgrade.txt +++ b/docs/upgrade.txt @@ -1,8 +1,8 @@ .. _laravel-upgrading: -========= -Upgrading -========= +=================== +Upgrade ODM Version +=================== .. facet:: :name: genre @@ -11,11 +11,67 @@ Upgrading .. meta:: :keywords: php framework, odm, code example +Overview +-------- + +On this page, you can learn how to upgrade {+odm-short+} to a new version. This page also +includes the changes you must make to your application to upgrade your ODM version +without losing functionality, if applicable. + The PHP library uses `semantic versioning `__. Upgrading to a new major version may require changes to your application. -Upgrading from version 3 to 4 ------------------------------ +How to Upgrade +-------------- + +Before you upgrade, perform the following actions: + +- Ensure the new driver version is compatible with the {+mdb-server+} version + your application connects to and the version of Node.js that your + application runs on. See the :ref:`` + page for this information. +- Address any breaking changes between the version of the driver + your application currently uses and your planned upgrade version in the + :ref:`` section of this guide. To learn + more about the {+mdb-server+} release compatibility changes, see the + :ref:`` section. + +.. tip:: + + You can minimize the amount of changes that you need to make to your + application when upgrading driver versions by using the + :ref:`{+stable-api+} `. + +To upgrade your driver version, run the following command in your application's +directory: + +.. code-block:: bash + + npm install mongodb@{+version+} + +To upgrade to a different version of the driver, replace the information after the +``@`` symbol with your preferred version number. For more information about the +``npm install`` command, see the `npm-install `__ +npm documentation. + +.. _laravel-breaking-changes: + +Breaking Changes +---------------- + +A breaking change is a modification in a convention or behavior in +a specific version of {+odm-short+} that may prevent your application from +working as expected. + +The breaking changes in this section are categorized by the major +version releases that introduced them. When upgrading ODM versions, +address all the breaking changes between your current version and the +planned upgrade version. + +.. _laravel-breaking-changes-v4.x: + +Version 4.x Breaking Changes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Laravel 10.x is required From 7a91a4356ed271fee230d1dffeb82b9d773453d3 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 7 Mar 2024 13:54:42 -0500 Subject: [PATCH 2/8] DOCSP-35933: Upgrade guide --- docs/upgrade.txt | 81 +++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/docs/upgrade.txt b/docs/upgrade.txt index 9276d6d28..182fff950 100644 --- a/docs/upgrade.txt +++ b/docs/upgrade.txt @@ -14,45 +14,32 @@ Upgrade ODM Version Overview -------- -On this page, you can learn how to upgrade {+odm-short+} to a new version. This page also -includes the changes you must make to your application to upgrade your ODM version -without losing functionality, if applicable. - -The PHP library uses `semantic versioning `__. Upgrading -to a new major version may require changes to your application. +On this page, you can learn how to upgrade {+odm-short+} to a new major version. +This page also includes the changes you must make to your application to upgrade +your object-document mapper (ODM) version without losing functionality, if applicable. How to Upgrade -------------- Before you upgrade, perform the following actions: -- Ensure the new driver version is compatible with the {+mdb-server+} version - your application connects to and the version of Node.js that your - application runs on. See the :ref:`` +- Ensure the new ODM version is compatible with the {+mdb-server+} version + your application connects to and the version of Laravel that your + application runs on. See the :ref:`` page for this information. -- Address any breaking changes between the version of the driver +- Address any breaking changes between the version of {+odm-short+} that your application currently uses and your planned upgrade version in the - :ref:`` section of this guide. To learn - more about the {+mdb-server+} release compatibility changes, see the - :ref:`` section. - -.. tip:: + :ref:`` section of this guide. - You can minimize the amount of changes that you need to make to your - application when upgrading driver versions by using the - :ref:`{+stable-api+} `. - -To upgrade your driver version, run the following command in your application's +To upgrade your ODM version, run the following command in your application's directory: .. code-block:: bash - npm install mongodb@{+version+} + composer require mongodb/laravel-mongodb:{+version+} -To upgrade to a different version of the driver, replace the information after the -``@`` symbol with your preferred version number. For more information about the -``npm install`` command, see the `npm-install `__ -npm documentation. +To upgrade to a different version of the ODM, replace the information after +``laravel-mongodb:`` with your preferred version number. .. _laravel-breaking-changes: @@ -73,33 +60,43 @@ planned upgrade version. Version 4.x Breaking Changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Laravel 10.x is required +This ODM version introduces the following breaking changes: + +- Minimum Laravel version is now 10.0. For instructions on upgrading your Laravel version, + see the `Upgrade Guide `__ in the Laravel + documentation. -- Change dependency name in your composer.json to ``"mongodb/laravel-mongodb": "^4.0"`` - and run ``composer update`` +- Dependency name is now ``"mongodb/laravel-mongodb"``. Ensure that the dependency + name in your ``composer.json`` file is ``"mongodb/laravel-mongodb": "^4.0"``. Then, run + ``composer update``. -- Change namespace from ``Jenssegers\Mongodb\`` to ``MongoDB\Laravel\`` - in your models and config +- Namespace is now ``MongoDB\Laravel\``. Ensure that you change the namespace from ``Jenssegers\Mongodb\`` + to ``MongoDB\Laravel\`` in your models and config files. -- Remove support for non-Laravel projects +- Removes support for non-Laravel projects. -- Replace ``$dates`` with ``$casts`` in your models +- Removes support for the ``$dates`` property. Ensure that you change all instances of ``$dates`` + to ``$casts`` in your model files. -- Call ``$model->save()`` after ``$model->unset('field')`` to persist the change +- ``Model::unset($field)`` does not persist the change. Ensure that you follow all calls to + ``Model::unset($field)`` with ``Model::save()``. -- Replace calls to ``Query\Builder::whereAll($column, $values)`` with - ``Query\Builder::where($column, 'all', $values)`` +- Removes the ``Query\Builder::whereAll($column, $values)`` method. Ensure that you replace all calls + to ``Query\Builder::whereAll($column, $values)`` with ``Query\Builder::where($column, 'all', $values)``. -- ``Query\Builder::delete()`` doesn't accept ``limit()`` other than ``1`` or ``null``. +- ``Query\Builder::delete()`` can only delete one or all documents. Ensure that you only pass a value + of ``1`` or ``null`` to ``limit()``. -- ``whereDate``, ``whereDay``, ``whereMonth``, ``whereYear``, ``whereTime`` - now use MongoDB operators on date fields +- ``whereDate()``, ``whereDay()``, ``whereMonth()``, ``whereYear()``, and ``whereTime()`` methods + now use MongoDB operators on date fields. -- Replace ``Illuminate\Database\Eloquent\MassPrunable`` with ``MongoDB\Laravel\Eloquent\MassPrunable`` - in your models +- Adds the ``MongoDB\Laravel\Eloquent\MassPrunable`` trait. Ensure that you replace all instances of + ``Illuminate\Database\Eloquent\MassPrunable`` with ``MongoDB\Laravel\Eloquent\MassPrunable`` + in your models. -- Remove calls to not-supported methods of ``Query\Builder``: ``toSql``, +- Removes support for the ``Query\Builder``: ``toSql``, ``toRawSql``, ``whereColumn``, ``whereFullText``, ``groupByRaw``, ``orderByRaw``, ``unionAll``, ``union``, ``having``, ``havingRaw``, ``havingBetween``, ``whereIntegerInRaw``, ``orWhereIntegerInRaw``, - ``whereIntegerNotInRaw``, ``orWhereIntegerNotInRaw``. + ``whereIntegerNotInRaw``, and ``orWhereIntegerNotInRaw`` methods. Ensure that you remove + all calls to these methods. From 27f9fe78ff3ee043656a534754f5a4aba0f8ce92 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 7 Mar 2024 14:41:18 -0500 Subject: [PATCH 3/8] source constant fix --- docs/upgrade.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/upgrade.txt b/docs/upgrade.txt index 182fff950..6c5d29879 100644 --- a/docs/upgrade.txt +++ b/docs/upgrade.txt @@ -36,7 +36,7 @@ directory: .. code-block:: bash - composer require mongodb/laravel-mongodb:{+version+} + composer require mongodb/laravel-mongodb:{+package-version+} To upgrade to a different version of the ODM, replace the information after ``laravel-mongodb:`` with your preferred version number. From d06d1fc06d13213c54a415beeee8c560d47b1714 Mon Sep 17 00:00:00 2001 From: norareidy Date: Thu, 7 Mar 2024 14:52:30 -0500 Subject: [PATCH 4/8] wording --- docs/upgrade.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/upgrade.txt b/docs/upgrade.txt index 6c5d29879..06a158c1f 100644 --- a/docs/upgrade.txt +++ b/docs/upgrade.txt @@ -23,7 +23,7 @@ How to Upgrade Before you upgrade, perform the following actions: -- Ensure the new ODM version is compatible with the {+mdb-server+} version +- Ensure the new ODM version is compatible with the MongoDB Server version your application connects to and the version of Laravel that your application runs on. See the :ref:`` page for this information. From 4ce2b8c8ae2ceacd54ebbdc38ad48d97fd6927a8 Mon Sep 17 00:00:00 2001 From: norareidy Date: Mon, 11 Mar 2024 16:32:34 -0400 Subject: [PATCH 5/8] JS feedback --- docs/upgrade.txt | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/docs/upgrade.txt b/docs/upgrade.txt index 06a158c1f..3eac73b7a 100644 --- a/docs/upgrade.txt +++ b/docs/upgrade.txt @@ -11,6 +11,12 @@ Upgrade ODM Version .. meta:: :keywords: php framework, odm, code example +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + Overview -------- @@ -47,8 +53,8 @@ Breaking Changes ---------------- A breaking change is a modification in a convention or behavior in -a specific version of {+odm-short+} that may prevent your application from -working as expected. +a specific version of {+odm-short+} that might prevent your application +from working as expected. The breaking changes in this section are categorized by the major version releases that introduced them. When upgrading ODM versions, @@ -84,8 +90,8 @@ This ODM version introduces the following breaking changes: - Removes the ``Query\Builder::whereAll($column, $values)`` method. Ensure that you replace all calls to ``Query\Builder::whereAll($column, $values)`` with ``Query\Builder::where($column, 'all', $values)``. -- ``Query\Builder::delete()`` can only delete one or all documents. Ensure that you only pass a value - of ``1`` or ``null`` to ``limit()``. +- ``Query\Builder::delete()`` can delete one or all documents. Ensure that you pass only the values + ``1`` or ``null`` to ``limit()``. - ``whereDate()``, ``whereDay()``, ``whereMonth()``, ``whereYear()``, and ``whereTime()`` methods now use MongoDB operators on date fields. @@ -94,9 +100,20 @@ This ODM version introduces the following breaking changes: ``Illuminate\Database\Eloquent\MassPrunable`` with ``MongoDB\Laravel\Eloquent\MassPrunable`` in your models. -- Removes support for the ``Query\Builder``: ``toSql``, - ``toRawSql``, ``whereColumn``, ``whereFullText``, ``groupByRaw``, - ``orderByRaw``, ``unionAll``, ``union``, ``having``, ``havingRaw``, - ``havingBetween``, ``whereIntegerInRaw``, ``orWhereIntegerInRaw``, - ``whereIntegerNotInRaw``, and ``orWhereIntegerNotInRaw`` methods. Ensure that you remove - all calls to these methods. +- Removes support for the following ``Query\Builder`` methods: + + - ``toSql()`` + - ``toRawSql()`` + - ``whereColumn()`` + - ``whereFullText()`` + - ``groupByRaw()`` + - ``orderByRaw()`` + - ``unionAll()`` + - ``union()`` + - ``having()`` + - ``havingRaw()`` + - ``havingBetween()`` + - ``whereIntegerInRaw()`` + - ``orWhereIntegerInRaw()`` + - ``whereIntegerNotInRaw()`` + - ``orWhereIntegerNotInRaw()`` From 37d24dc3fd5ae305de6f2b40327226c67a5e8488 Mon Sep 17 00:00:00 2001 From: norareidy Date: Tue, 12 Mar 2024 16:49:52 -0400 Subject: [PATCH 6/8] odm to library --- docs/upgrade.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/upgrade.txt b/docs/upgrade.txt index 3eac73b7a..1aeba2be3 100644 --- a/docs/upgrade.txt +++ b/docs/upgrade.txt @@ -1,8 +1,8 @@ .. _laravel-upgrading: -=================== -Upgrade ODM Version -=================== +======================= +Upgrade Library Version +======================= .. facet:: :name: genre @@ -29,7 +29,7 @@ How to Upgrade Before you upgrade, perform the following actions: -- Ensure the new ODM version is compatible with the MongoDB Server version +- Ensure the new library version is compatible with the MongoDB Server version your application connects to and the version of Laravel that your application runs on. See the :ref:`` page for this information. @@ -37,14 +37,14 @@ Before you upgrade, perform the following actions: your application currently uses and your planned upgrade version in the :ref:`` section of this guide. -To upgrade your ODM version, run the following command in your application's +To upgrade your library version, run the following command in your application's directory: .. code-block:: bash composer require mongodb/laravel-mongodb:{+package-version+} -To upgrade to a different version of the ODM, replace the information after +To upgrade to a different version of the library, replace the information after ``laravel-mongodb:`` with your preferred version number. .. _laravel-breaking-changes: @@ -57,7 +57,7 @@ a specific version of {+odm-short+} that might prevent your application from working as expected. The breaking changes in this section are categorized by the major -version releases that introduced them. When upgrading ODM versions, +version releases that introduced them. When upgrading library versions, address all the breaking changes between your current version and the planned upgrade version. @@ -66,7 +66,7 @@ planned upgrade version. Version 4.x Breaking Changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This ODM version introduces the following breaking changes: +This library version introduces the following breaking changes: - Minimum Laravel version is now 10.0. For instructions on upgrading your Laravel version, see the `Upgrade Guide `__ in the Laravel From f266cf1056c14bcdacea30717f727e4f21515fbd Mon Sep 17 00:00:00 2001 From: norareidy Date: Tue, 12 Mar 2024 20:50:23 +0000 Subject: [PATCH 7/8] apply phpcbf formatting --- src/Query/Builder.php | 5 ----- tests/Models/User.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Query/Builder.php b/src/Query/Builder.php index 98e6640df..27e788db8 100644 --- a/src/Query/Builder.php +++ b/src/Query/Builder.php @@ -1158,11 +1158,6 @@ protected function compileWheres(): array return $compiled; } - /** - * @param array $where - * - * @return array - */ protected function compileWhereBasic(array $where): array { $column = $where['column']; diff --git a/tests/Models/User.php b/tests/Models/User.php index f2d2cf7cc..98f76d931 100644 --- a/tests/Models/User.php +++ b/tests/Models/User.php @@ -130,7 +130,7 @@ protected function username(): Attribute { return Attribute::make( get: fn ($value) => $value, - set: fn ($value) => Str::slug($value) + set: fn ($value) => Str::slug($value), ); } From 01e24d8ac75c48cf097bd90c25726d72eda3e7cd Mon Sep 17 00:00:00 2001 From: norareidy Date: Wed, 13 Mar 2024 16:10:16 -0400 Subject: [PATCH 8/8] empty commit (checks)