Closed denisyilmaz closed 7 months ago
any idea how this can be solved?
Thanks for reporting this bug. This is now fixed in version 4.0.1.
Thanks. While the mentioned error is now gone I see another issue. When adding arguments to the fragments field (like zone/type) i get the following errors now.
{
"errors": [
{
"debugMessage": "Method craft\\elements\\ElementCollection::type does not exist.",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"trace": [
{
"file": "/var/www/html/vendor/thepixelage/craft-fragments/src/gql/resolvers/elements/Fragment.php",
"line": 38,
"call": "Illuminate\\Support\\Collection::__call('type', array(1))"
},
{
"file": "/var/www/html/vendor/craftcms/cms/src/gql/base/ElementResolver.php",
"line": 88,
"call": "thepixelage\\fragments\\gql\\resolvers\\elements\\Fragment::prepareQuery(instance of craft\\elements\\Entry, array(2), 'banners')"
},
{
"file": "/var/www/html/vendor/craftcms/cms/src/gql/base/ElementResolver.php",
"line": 50,
"call": "craft\\gql\\base\\ElementResolver::prepareElementQuery(instance of craft\\elements\\Entry, array(2), array(2), instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
...
}]
}
Deleting the argument results in the query to return all the expected fragments without any issue! So thats great!
Ah, this is quite an unexpected use case for us for the fragments field, but I can see why it might be good to be able to filter zone and type as well, if not just for parity reason. We will change this in the next release.
Version 4.0.2 is out which addresses the bug that causes type
and zone
arguments to raise errors. At the same time, we have removed some arguments that will not make sense at all in Fragments field (such as entryUri
). Hope this helps with what you are trying to achieve.
We try to query for the fragements field inside of our entries. This is currently resulting in a internal server error. I tried different queires, with/without the arguments for zone/type. allways the same error.
Query
Error
2023-01-16 12:22:22 [web.ERROR] [TypeError] thepixelage\fragments\services\Fragments::matchConditions(): Argument #1 ($fragment) must be of type thepixelage\fragments\elements\Fragment, array given, called in /home/webapp/the-app/releases/1673867002707/vendor/thepixelage/craft-fragments/src/elements/db/FragmentQuery.php on line 97 {"trace":["#0 /home/webapp/the-app/releases/1673867002707/vendor/thepixelage/craft-fragments/src/elements/db/FragmentQuery.php(97): thepixelage\\fragments\\services\\Fragments->matchConditions()","#1 [internal function]: thepixelage\\fragments\\elements\\db\\FragmentQuery->thepixelage\\fragments\\elements\\db\\{closure}()","#2 /home/webapp/the-app/releases/1673867002707/vendor/thepixelage/craft-fragments/src/elements/db/FragmentQuery.php(98): array_filter()","#3 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/services/Elements.php(2639): thepixelage\\fragments\\elements\\db\\FragmentQuery->all()","#4 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/services/Elements.php(2517): craft\\services\\Elements->_eagerLoadElementsInternal()","#5 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/elements/db/ElementQuery.php(2978): craft\\services\\Elements->eagerLoadElements()","#6 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1453): craft\\elements\\db\\ElementQuery->_createElements()","#7 /home/webapp/the-app/releases/1673867002707/vendor/yiisoft/yii2/db/Query.php(251): craft\\elements\\db\\ElementQuery->populate()","#8 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/db/Query.php(248): yii\\db\\Query->all()","#9 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1492): craft\\db\\Query->all()","#10 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/gql/base/ElementResolver.php(51): craft\\elements\\db\\ElementQuery->all()","#11 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(623): craft\\gql\\base\\ElementResolver::resolve()","#12 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(550): GraphQL\\Executor\\ReferenceExecutor->resolveFieldValueOrError()","#13 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(1195): GraphQL\\Executor\\ReferenceExecutor->resolveField()","#14 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(264): GraphQL\\Executor\\ReferenceExecutor->executeFields()","#15 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(215): GraphQL\\Executor\\ReferenceExecutor->executeOperation()","#16 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/Executor/Executor.php(156): GraphQL\\Executor\\ReferenceExecutor->doExecute()","#17 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/GraphQL.php(162): GraphQL\\Executor\\Executor::promiseToExecute()","#18 /home/webapp/the-app/releases/1673867002707/vendor/webonyx/graphql-php/src/GraphQL.php(94): GraphQL\\GraphQL::promiseToExecute()","#19 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/services/Gql.php(512): GraphQL\\GraphQL::executeQuery()","#20 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/controllers/GraphqlController.php(177): craft\\services\\Gql->executeQuery()","#21 [internal function]: craft\\controllers\\GraphqlController->actionApi()","#22 /home/webapp/the-app/releases/1673867002707/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#23 /home/webapp/the-app/releases/1673867002707/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()","#24 /home/webapp/the-app/releases/1673867002707/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()","#25 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/web/Application.php(301): yii\\base\\Module->runAction()","#26 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/web/Application.php(625): craft\\web\\Application->runAction()","#27 /home/webapp/the-app/releases/1673867002707/vendor/craftcms/cms/src/web/Application.php(280): craft\\web\\Application->_processActionRequest()","#28 /home/webapp/the-app/releases/1673867002707/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()","#29 /home/webapp/the-app/releases/1673867002707/web/index.php(12): yii\\base\\Application->run()","#30 {main}"],"memory":67423680,"exception":"[object] (TypeError(code: 0): thepixelage\\fragments\\services\\Fragments::matchConditions(): Argument #1 ($fragment) must be of type thepixelage\\fragments\\elements\\Fragment, array given, called in /home/webapp/the-app/releases/1673867002707/vendor/thepixelage/craft-fragments/src/elements/db/FragmentQuery.php on line 97 at /home/webapp/the-app/releases/1673867002707/vendor/thepixelage/craft-fragments/src/services/Fragments.php:26)"}