diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 69e9d8d..bd564aa 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -37,7 +37,7 @@ body: description: >- Paste or attach the PHP or JSON export of the ACF Field Group(s) related to the problem. - Attach as Github supported file type, ie .txt or .zip + Attach as Github supported file type, ie .txt or .zip. I recommend exporting the ACF Field group as JSON then compressing as a .zip to upload. - type: textarea attributes: label: Additional context diff --git a/CHANGELOG.md b/CHANGELOG.md index 0157842..4de0060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.1.2 + +### Chores / Bugfixes + +- [#178](https://github.com/wp-graphql/wpgraphql-acf/pull/178): fix: Taxonomy field returns incorrect data if set to store objects instead of IDs +- [#174](https://github.com/wp-graphql/wpgraphql-acf/pull/174): fix: taxonomy field resolves sorted in the incorrect order + ## 2.1.1 ### Chores / Bugfixes diff --git a/composer.lock b/composer.lock index 6de53cd..1dae775 100644 --- a/composer.lock +++ b/composer.lock @@ -158,16 +158,16 @@ }, { "name": "axepress/wp-graphql-stubs", - "version": "v1.18.2", + "version": "v1.21.0", "source": { "type": "git", "url": "https://github.com/AxeWP/wp-graphql-stubs.git", - "reference": "3f5636778cbff0fc4383cf896df6a99d593b62d6" + "reference": "4576d7a7b4e5c9117d841bbe2b340e623f566942" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AxeWP/wp-graphql-stubs/zipball/3f5636778cbff0fc4383cf896df6a99d593b62d6", - "reference": "3f5636778cbff0fc4383cf896df6a99d593b62d6", + "url": "https://api.github.com/repos/AxeWP/wp-graphql-stubs/zipball/4576d7a7b4e5c9117d841bbe2b340e623f566942", + "reference": "4576d7a7b4e5c9117d841bbe2b340e623f566942", "shasum": "" }, "require": { @@ -198,7 +198,7 @@ ], "support": { "issues": "https://github.com/AxeWP/wp-graphql-stubs/issues", - "source": "https://github.com/AxeWP/wp-graphql-stubs/tree/v1.18.2" + "source": "https://github.com/AxeWP/wp-graphql-stubs/tree/v1.21.0" }, "funding": [ { @@ -206,7 +206,7 @@ "type": "github" } ], - "time": "2023-11-11T14:05:57+00:00" + "time": "2024-02-11T16:43:25+00:00" }, { "name": "behat/gherkin", @@ -1182,41 +1182,123 @@ ], "time": "2023-12-18T12:05:55+00:00" }, + { + "name": "composer/class-map-generator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/composer/class-map-generator.git", + "reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/953cc4ea32e0c31f2185549c7d216d7921f03da9", + "reference": "953cc4ea32e0c31f2185549c7d216d7921f03da9", + "shasum": "" + }, + "require": { + "composer/pcre": "^2.1 || ^3.1", + "php": "^7.2 || ^8.0", + "symfony/finder": "^4.4 || ^5.3 || ^6 || ^7" + }, + "require-dev": { + "phpstan/phpstan": "^1.6", + "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/filesystem": "^5.4 || ^6", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\ClassMapGenerator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Utilities to scan PHP code and generate class maps.", + "keywords": [ + "classmap" + ], + "support": { + "issues": "https://github.com/composer/class-map-generator/issues", + "source": "https://github.com/composer/class-map-generator/tree/1.1.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2023-06-30T13:58:57+00:00" + }, { "name": "composer/composer", - "version": "2.2.23", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "d1542e89636abf422fde328cb28d53752efb69e5" + "reference": "aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/d1542e89636abf422fde328cb28d53752efb69e5", - "reference": "d1542e89636abf422fde328cb28d53752efb69e5", + "url": "https://api.github.com/repos/composer/composer/zipball/aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc", + "reference": "aaf6ed5ccd27c23f79a545e351b4d7842a99d0bc", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", + "composer/class-map-generator": "^1.0", "composer/metadata-minifier": "^1.0", - "composer/pcre": "^1.0", - "composer/semver": "^3.0", - "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^2.0 || ^3.0", + "composer/pcre": "^2.1 || ^3.1", + "composer/semver": "^3.2.5", + "composer/spdx-licenses": "^1.5.7", + "composer/xdebug-handler": "^2.0.2 || ^3.0.3", "justinrainbow/json-schema": "^5.2.11", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0 || ^2.0", - "react/promise": "^1.2 || ^2.7", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "react/promise": "^2.8 || ^3", "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", - "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0" + "seld/phar-utils": "^1.2", + "seld/signal-handler": "^2.0", + "symfony/console": "^5.4.11 || ^6.0.11 || ^7", + "symfony/filesystem": "^5.4 || ^6.0 || ^7", + "symfony/finder": "^5.4 || ^6.0 || ^7", + "symfony/polyfill-php73": "^1.24", + "symfony/polyfill-php80": "^1.24", + "symfony/polyfill-php81": "^1.24", + "symfony/process": "^5.4 || ^6.0 || ^7" }, "require-dev": { - "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" + "phpstan/phpstan": "^1.9.3", + "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1", + "phpstan/phpstan-symfony": "^1.2.10", + "symfony/phpunit-bridge": "^6.4.1 || ^7.0.1" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -1229,12 +1311,17 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.2-dev" + "dev-main": "2.7-dev" + }, + "phpstan": { + "includes": [ + "phpstan/rules.neon" + ] } }, "autoload": { "psr-4": { - "Composer\\": "src/Composer" + "Composer\\": "src/Composer/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1263,7 +1350,8 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.2.23" + "security": "https://github.com/composer/composer/security/policy", + "source": "https://github.com/composer/composer/tree/2.7.1" }, "funding": [ { @@ -1279,7 +1367,7 @@ "type": "tidelift" } ], - "time": "2024-02-08T14:08:53+00:00" + "time": "2024-02-09T14:26:28+00:00" }, { "name": "composer/metadata-minifier", @@ -1352,30 +1440,30 @@ }, { "name": "composer/pcre", - "version": "1.0.1", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" + "reference": "b439557066cd445732fa57cbc8d905394b4db8a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "url": "https://api.github.com/repos/composer/pcre/zipball/b439557066cd445732fa57cbc8d905394b4db8a0", + "reference": "b439557066cd445732fa57cbc8d905394b4db8a0", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5" + "symfony/phpunit-bridge": "^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -1403,7 +1491,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.1" + "source": "https://github.com/composer/pcre/tree/2.1.1" }, "funding": [ { @@ -1419,7 +1507,7 @@ "type": "tidelift" } ], - "time": "2022-01-21T20:24:37+00:00" + "time": "2023-10-11T07:10:55+00:00" }, { "name": "composer/semver", @@ -1771,16 +1859,16 @@ }, { "name": "doctrine/inflector", - "version": "2.0.9", + "version": "2.0.10", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65" + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc", + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc", "shasum": "" }, "require": { @@ -1842,7 +1930,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.9" + "source": "https://github.com/doctrine/inflector/tree/2.0.10" }, "funding": [ { @@ -1858,7 +1946,7 @@ "type": "tidelift" } ], - "time": "2024-01-15T18:05:13+00:00" + "time": "2024-02-18T20:23:39+00:00" }, { "name": "doctrine/instantiator", @@ -2832,16 +2920,16 @@ }, { "name": "mck89/peast", - "version": "v1.16.0", + "version": "v1.16.1", "source": { "type": "git", "url": "https://github.com/mck89/peast.git", - "reference": "63dee902bd281c792f1dd760b6df268682032ed0" + "reference": "f6e681062bb25c8dacbd30e079f4ad3fd890d7ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mck89/peast/zipball/63dee902bd281c792f1dd760b6df268682032ed0", - "reference": "63dee902bd281c792f1dd760b6df268682032ed0", + "url": "https://api.github.com/repos/mck89/peast/zipball/f6e681062bb25c8dacbd30e079f4ad3fd890d7ad", + "reference": "f6e681062bb25c8dacbd30e079f4ad3fd890d7ad", "shasum": "" }, "require": { @@ -2854,7 +2942,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.16.0-dev" + "dev-master": "1.16.1-dev" } }, "autoload": { @@ -2875,9 +2963,9 @@ "description": "Peast is PHP library that generates AST for JavaScript code", "support": { "issues": "https://github.com/mck89/peast/issues", - "source": "https://github.com/mck89/peast/tree/v1.16.0" + "source": "https://github.com/mck89/peast/tree/v1.16.1" }, - "time": "2024-01-11T14:36:12+00:00" + "time": "2024-02-14T08:15:19+00:00" }, { "name": "mikehaertl/php-shellcommand", @@ -3464,16 +3552,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.4.1", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "6d6063cf9464a306ca2a0529705d41312b08500b" + "reference": "6105bdab2f26c0204fe90ecc53d5684754550e8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/6d6063cf9464a306ca2a0529705d41312b08500b", - "reference": "6d6063cf9464a306ca2a0529705d41312b08500b", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/6105bdab2f26c0204fe90ecc53d5684754550e8f", + "reference": "6105bdab2f26c0204fe90ecc53d5684754550e8f", "shasum": "" }, "require-dev": { @@ -3482,9 +3570,9 @@ "php": "^7.4 || ~8.0.0", "php-stubs/generator": "^0.8.3", "phpdocumentor/reflection-docblock": "^5.3", - "phpstan/phpstan": "^1.10.12", + "phpstan/phpstan": "^1.10.49", "phpunit/phpunit": "^9.5", - "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8" + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.11" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", @@ -3505,9 +3593,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.4.1" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.4.3" }, - "time": "2023-11-10T00:33:47+00:00" + "time": "2024-02-11T18:56:19+00:00" }, { "name": "php-webdriver/webdriver", @@ -4008,16 +4096,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.57", + "version": "1.10.59", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" + "reference": "e607609388d3a6d418a50a49f7940e8086798281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", + "reference": "e607609388d3a6d418a50a49f7940e8086798281", "shasum": "" }, "require": { @@ -4066,7 +4154,7 @@ "type": "tidelift" } ], - "time": "2024-01-24T11:51:34+00:00" + "time": "2024-02-20T13:59:13+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4836,23 +4924,24 @@ }, { "name": "react/promise", - "version": "v2.11.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831" + "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/1a8460931ea36dc5c76838fec5734d55c88c6831", - "reference": "1a8460931ea36dc5c76838fec5734d55c88c6831", + "url": "https://api.github.com/repos/reactphp/promise/zipball/e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", + "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" }, "type": "library", "autoload": { @@ -4896,7 +4985,7 @@ ], "support": { "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.11.0" + "source": "https://github.com/reactphp/promise/tree/v3.1.0" }, "funding": [ { @@ -4904,7 +4993,7 @@ "type": "open_collective" } ], - "time": "2023-11-16T16:16:50+00:00" + "time": "2023-11-16T16:21:57+00:00" }, { "name": "sebastian/cli-parser", @@ -5982,6 +6071,67 @@ }, "time": "2022-08-31T10:31:18+00:00" }, + { + "name": "seld/signal-handler", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/signal-handler.git", + "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/signal-handler/zipball/04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98", + "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "require-dev": { + "phpstan/phpstan": "^1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^7.5.20 || ^8.5.23", + "psr/log": "^1 || ^2 || ^3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\Signal\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development", + "keywords": [ + "posix", + "sigint", + "signal", + "sigterm", + "unix" + ], + "support": { + "issues": "https://github.com/Seldaek/signal-handler/issues", + "source": "https://github.com/Seldaek/signal-handler/tree/2.0.2" + }, + "time": "2023-09-03T09:24:00+00:00" + }, { "name": "simpod/php-coveralls-mirror", "version": "v3.0.1", @@ -6263,16 +6413,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", "shasum": "" }, "require": { @@ -6339,7 +6489,7 @@ "type": "open_collective" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2024-02-16T15:06:51+00:00" }, { "name": "symfony/browser-kit", @@ -9070,20 +9220,20 @@ }, { "name": "wp-cli/entity-command", - "version": "v2.5.6", + "version": "v2.6.2", "source": { "type": "git", "url": "https://github.com/wp-cli/entity-command.git", - "reference": "45d4f3a77b7977fee4b4f7e183e692ab84bf7dd8" + "reference": "2b5d5d54550edb7383ebaa77fb3a2d53871ba19a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/45d4f3a77b7977fee4b4f7e183e692ab84bf7dd8", - "reference": "45d4f3a77b7977fee4b4f7e183e692ab84bf7dd8", + "url": "https://api.github.com/repos/wp-cli/entity-command/zipball/2b5d5d54550edb7383ebaa77fb3a2d53871ba19a", + "reference": "2b5d5d54550edb7383ebaa77fb3a2d53871ba19a", "shasum": "" }, "require": { - "wp-cli/wp-cli": "^2.5" + "wp-cli/wp-cli": "^2.10" }, "require-dev": { "wp-cli/cache-command": "^1 || ^2", @@ -9156,6 +9306,8 @@ "option patch", "option pluck", "option update", + "option set-autoload", + "option get-autoload", "post", "post create", "post delete", @@ -9179,6 +9331,7 @@ "post term remove", "post term set", "post update", + "post url-to-id", "post-type", "post-type get", "post-type list", @@ -9275,9 +9428,9 @@ "homepage": "https://github.com/wp-cli/entity-command", "support": { "issues": "https://github.com/wp-cli/entity-command/issues", - "source": "https://github.com/wp-cli/entity-command/tree/v2.5.6" + "source": "https://github.com/wp-cli/entity-command/tree/v2.6.2" }, - "time": "2023-10-13T13:38:49+00:00" + "time": "2024-02-06T13:38:03+00:00" }, { "name": "wp-cli/eval-command", @@ -9402,21 +9555,21 @@ }, { "name": "wp-cli/extension-command", - "version": "v2.1.17", + "version": "v2.1.19", "source": { "type": "git", "url": "https://github.com/wp-cli/extension-command.git", - "reference": "955bd947d95ef91da501179c7e561d229ab3cc19" + "reference": "80713703e090fbc74926af6f75bf963619f76fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/955bd947d95ef91da501179c7e561d229ab3cc19", - "reference": "955bd947d95ef91da501179c7e561d229ab3cc19", + "url": "https://api.github.com/repos/wp-cli/extension-command/zipball/80713703e090fbc74926af6f75bf963619f76fdb", + "reference": "80713703e090fbc74926af6f75bf963619f76fdb", "shasum": "" }, "require": { "composer/semver": "^1.4 || ^2 || ^3", - "wp-cli/wp-cli": "^2.5.1" + "wp-cli/wp-cli": "^2.10" }, "require-dev": { "wp-cli/cache-command": "^2.0", @@ -9494,9 +9647,9 @@ "homepage": "https://github.com/wp-cli/extension-command", "support": { "issues": "https://github.com/wp-cli/extension-command/issues", - "source": "https://github.com/wp-cli/extension-command/tree/v2.1.17" + "source": "https://github.com/wp-cli/extension-command/tree/v2.1.19" }, - "time": "2024-01-11T11:03:21+00:00" + "time": "2024-02-05T14:53:09+00:00" }, { "name": "wp-cli/i18n-command", @@ -10506,16 +10659,16 @@ }, { "name": "wp-cli/wp-cli", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7" + "reference": "a339dca576df73c31af4b4d8054efc2dab9a0685" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", - "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/a339dca576df73c31af4b4d8054efc2dab9a0685", + "reference": "a339dca576df73c31af4b4d8054efc2dab9a0685", "shasum": "" }, "require": { @@ -10545,7 +10698,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.9.x-dev" + "dev-main": "2.10.x-dev" } }, "autoload": { @@ -10572,24 +10725,23 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2023-10-25T09:06:37+00:00" + "time": "2024-02-08T16:52:43+00:00" }, { "name": "wp-cli/wp-cli-bundle", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli-bundle.git", - "reference": "3512737e69e55507172e8dce400e09231ba95919" + "reference": "b795ca19f12bf9605dc8d85235d55a721b43064c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli-bundle/zipball/3512737e69e55507172e8dce400e09231ba95919", - "reference": "3512737e69e55507172e8dce400e09231ba95919", + "url": "https://api.github.com/repos/wp-cli/wp-cli-bundle/zipball/b795ca19f12bf9605dc8d85235d55a721b43064c", + "reference": "b795ca19f12bf9605dc8d85235d55a721b43064c", "shasum": "" }, "require": { - "composer/composer": "^1.10.23 || ~2.2.17", "php": ">=5.6", "wp-cli/cache-command": "^2", "wp-cli/checksum-command": "^2.1", @@ -10616,7 +10768,7 @@ "wp-cli/shell-command": "^2", "wp-cli/super-admin-command": "^2", "wp-cli/widget-command": "^2", - "wp-cli/wp-cli": "^2.9.0" + "wp-cli/wp-cli": "^2.10.0" }, "require-dev": { "roave/security-advisories": "dev-latest", @@ -10646,7 +10798,7 @@ "issues": "https://github.com/wp-cli/wp-cli-bundle/issues", "source": "https://github.com/wp-cli/wp-cli-bundle" }, - "time": "2023-10-25T09:28:58+00:00" + "time": "2024-02-08T17:05:33+00:00" }, { "name": "wp-cli/wp-config-transformer", @@ -10894,5 +11046,5 @@ "platform-overrides": { "php": "7.3" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/readme.txt b/readme.txt index fd3ec6e..cfd36fb 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: GraphQL, ACF, API, NextJS, Faust, Headless, Decoupled, React, Vue, Svelte, Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.4 -Stable Tag: 2.1.1 +Stable Tag: 2.1.2 License: GPL-3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -116,6 +116,13 @@ This release is a complete re-architecture of WPGraphQL for ACF, introducing bre == Changelog == += 2.1.2 = + +**Chores / Bugfixes** + +- [#178](https://github.com/wp-graphql/wpgraphql-acf/pull/178): fix: Taxonomy field returns incorrect data if set to store objects instead of IDs +- [#174](https://github.com/wp-graphql/wpgraphql-acf/pull/174): fix: taxonomy field resolves sorted in the incorrect order + = 2.1.1 = **Chores / Bugfixes** diff --git a/src/FieldType/Taxonomy.php b/src/FieldType/Taxonomy.php index 44334b1..6cdd459 100644 --- a/src/FieldType/Taxonomy.php +++ b/src/FieldType/Taxonomy.php @@ -33,20 +33,35 @@ public static function register_field_type(): void { $values = $value; } - $ids = array_map( - static function ( $id ) { - return absint( $id ); - }, - $values + $ids = array_filter( + array_map( + static function ( $value ) { + $id = $value; + if ( is_array( $value ) && isset( $value['term_id'] ) ) { + $id = $value['term_id']; + } + if ( isset( $value->term_id ) ) { + $id = $value->term_id; + } + + $id = absint( $id ); + return ! empty( $id ) ? $id : null; + }, + $values + ) ); if ( empty( $ids ) ) { return null; } - $args['where']['include'] = $ids; - - return ( new TermObjectConnectionResolver( $root, $args, $context, $info ) )->get_connection(); + // set the default ordering if not overridden by args input on the field + $args['where']['include'] = array_values( $ids ); + $args['where']['orderby'] = $args['where']['orderby'] ?? 'include'; + $args['where']['order'] = $args['where']['order'] ?? 'ASC'; + $args['first'] = count( $ids ); + $resolver = new TermObjectConnectionResolver( $root, $args, $context, $info, 'any' ); + return $resolver->get_connection(); }, ]; diff --git a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php index 9bd8621..3ee8c42 100644 --- a/tests/wpunit/FieldTypes/TaxonomyFieldTest.php +++ b/tests/wpunit/FieldTypes/TaxonomyFieldTest.php @@ -93,6 +93,104 @@ public function get_expected_block_fragment_response() { ]; } + public function testQueryReturnsTermsInOrderTheyWereSaved() { + + $field_key = $this->register_acf_field([ + 'type' => 'taxonomy', + 'name' => 'tax_term_order_test', + 'show_in_graphql' => true, + 'graphql_field_name' => 'termOrderTest', + 'required' => 1, + 'taxonomy' => 'category', + 'add_term' => 0, + 'save_terms' => 0, + 'load_terms' => 0, + 'return_format' => 'id', + 'field_type' => 'multi_select', + 'multiple' => 1, + 'bidirectonal' => 0, + 'bidirectional_target' => [], + ], [ + 'name' => 'Taxonomy Order Test', + 'graphql_field_name' => 'TaxonomyOrderTest', + 'location' => [ + [ + [ + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post', + ] + ] + ], + 'graphql_types' => [ 'Post' ], + ]); + + $cat_aaa = self::factory()->category->create([ + 'name' => 'AAA' + ]); + + $cat_bbb = self::factory()->category->create([ + 'name' => 'BBB' + ]); + + $cat_ccc = self::factory()->category->create([ + 'name' => 'CCC' + ]); + + $cats = [$cat_ccc, $cat_aaa, $cat_bbb]; + + update_field( $field_key, $cats, $this->published_post ); + + $query = ' + query GetPost($id:ID!) { + post(id:$id idType:DATABASE_ID) { + id + databaseId + taxonomyOrderTest { + termOrderTest { + nodes { + __typename + databaseId + } + } + } + } + } + '; + + $actual = $this->graphql([ + 'query' => $query, + 'variables' => [ + 'id' => $this->published_post->ID, + ] + ]); + + codecept_debug( [ + '$actual' => $actual, + '$cats' => $cats, + ]); + + self::assertQuerySuccessful( $actual, [ + $this->expectedNode( 'post.taxonomyOrderTest.termOrderTest.nodes', [ + '__typename' => 'Category', + 'databaseId' => $cats[0] + ], 0 ), + $this->expectedNode( 'post.taxonomyOrderTest.termOrderTest.nodes', [ + '__typename' => 'Category', + 'databaseId' => $cats[1] + ], 1 ), + $this->expectedNode( 'post.taxonomyOrderTest.termOrderTest.nodes', [ + '__typename' => 'Category', + 'databaseId' => $cats[2] + ], 2 ), + ]); + + foreach ( $cats as $cat ) { + wp_delete_term( $cat, 'category' ); + } + + } + public function testQueryTaxononomyFieldOnBlock() { // if ACF PRO is not active, skip the test @@ -294,4 +392,89 @@ interfaces { wp_delete_term( $category_id, 'category' ); wp_delete_term( $category_2_id, 'category' ); } + + public function testTaxonomyFieldReturnsExpectedNodeWhenObjectIsSavedInsteadOfId() { + + register_taxonomy( 'test_taxonomy', 'post', [ + 'show_in_graphql' => true, + 'graphql_single_name' => 'TestCustomTaxonomy', + 'graphql_plural_name' => 'TestCustomTaxonomies', + ] ); + + $term_object = self::factory()->term->create_and_get( [ + 'taxonomy' => 'test_taxonomy', + 'name' => 'Test Term', + ] ); + + $field_key = $this->register_acf_field([ + 'type' => 'taxonomy', + 'name' => 'taxonomy_field_test', + 'show_in_graphql' => true, + 'graphql_field_name' => 'testTaxonomyField', + 'required' => 1, + 'taxonomy' => 'category', + 'add_term' => 0, + 'save_terms' => 0, + 'load_terms' => 0, + 'return_format' => 'object', + 'field_type' => 'select', + 'multiple' => 0, + 'bidirectonal' => 0, + 'bidirectional_target' => [], + ], [ + 'name' => 'Post Taxonomy Test', + 'graphql_field_name' => 'TaxonomyFieldTest', + 'location' => [ + [ + [ + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post', + ] + ] + ], + 'graphql_types' => [ 'Post' ], + ]); + + update_field( $field_key, $term_object->term_id, $this->published_post->ID ); + + $query = ' + query GetPostAndTaxonomyField( $id: ID! ){ + post(id:$id idType:DATABASE_ID) { + id + title + taxonomyFieldTest { + testTaxonomyField { + nodes { + __typename + databaseId + } + } + } + } + }'; + + $variables = [ + 'id' => $this->published_post->ID, + ]; + + $actual = $this->graphql([ + 'query' => $query, + 'variables' => $variables, + ]); + + self::assertQuerySuccessful( $actual, [ + $this->expectedNode( 'post.taxonomyFieldTest.testTaxonomyField.nodes', [ + '__typename' => 'TestCustomTaxonomy', + 'databaseId' => $term_object->term_id, + ], 0 ), + ]); + + // cleanup + wp_delete_term( $term_object->term_id, 'test_taxonomy' ); + unregister_taxonomy( 'test_taxonomy' ); + + } + + } diff --git a/wpgraphql-acf.php b/wpgraphql-acf.php index bca9d61..9a82967 100644 --- a/wpgraphql-acf.php +++ b/wpgraphql-acf.php @@ -4,7 +4,7 @@ * Description: WPGraphQL for ACF seamlessly integrates Advanced Custom Fields with WPGraphQL. * Author: WPGraphQL, Jason Bahl * Author URI: https://www.wpgraphql.com - * Version: 2.1.1 + * Version: 2.1.2 * Text Domain: wpgraphql-acf * Requires PHP: 7.3 * Requires at least: 5.9 @@ -31,7 +31,7 @@ } if ( ! defined( 'WPGRAPHQL_FOR_ACF_VERSION' ) ) { - define( 'WPGRAPHQL_FOR_ACF_VERSION', '2.1.1' ); + define( 'WPGRAPHQL_FOR_ACF_VERSION', '2.1.2' ); } if ( ! defined( 'WPGRAPHQL_FOR_ACF_VERSION_WPGRAPHQL_REQUIRED_MIN_VERSION' ) ) {