Skip to content

Message: Looping through element queries directly has been deprecated. #1983

@droid51

Description

@droid51

Description

I got an Deprecation Error Looping through element queries directly has been deprecated.
I'm not using Twig, only the Element-API with NodeJS

Origin

/.../vendor/league/fractal/src/Scope.php:317

Stacktrace

13	Deprecation error: Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.
Called from /.../vendor/craftcms/cms/src/elements/db/ElementQuery.php:398
12	craft\elements\db\EntryQuery::getIterator()
Called from /.../vendor/league/fractal/src/Scope.php:317
11	League\Fractal\Scope::executeResourceTransformers()
Called from /.../vendor/league/fractal/src/Scope.php:234
10	League\Fractal\Scope::toArray()
Called from /.../vendor/craftcms/element-api/src/controllers/DefaultController.php:155
9	craft\elementapi\controllers\DefaultController::actionIndex("api/structure/faqs/<languageID:[a-z]{2}>")
8	call_user_func_array([craft\elementapi\controllers\DefaultController, "actionIndex"], ["api/structure/faqs/<languageID:[a-z]{2}>"])
Called from /.../vendor/yiisoft/yii2/base/InlineAction.php:57
7	yii\base\InlineAction::runWithParams(["pattern" => "api/structure/faqs/<languageID:[a-z]{2}>", "languageID" => "de", "p" => "api/structure/faqs/de"])
Called from /.../vendor/yiisoft/yii2/base/Controller.php:156
6	craft\elementapi\controllers\DefaultController::runAction("", ["pattern" => "api/structure/faqs/<languageID:[a-z]{2}>", "languageID" => "de", "p" => "api/structure/faqs/de"])
Called from /.../vendor/yiisoft/yii2/base/Module.php:523
5	craft\web\Application::runAction("element-api", ["pattern" => "api/structure/faqs/<languageID:[a-z]{2}>", "languageID" => "de", "p" => "api/structure/faqs/de"])
Called from /.../vendor/craftcms/cms/src/web/Application.php:241
4	craft\web\Application::runAction("element-api", ["pattern" => "api/structure/faqs/<languageID:[a-z]{2}>", "languageID" => "de", "p" => "api/structure/faqs/de"])
Called from /.../vendor/yiisoft/yii2/web/Application.php:102
3	craft\web\Application::handleRequest(craft\web\Request)
Called from /.../vendor/craftcms/cms/src/web/Application.php:206
2	craft\web\Application::handleRequest(craft\web\Request)
Called from /.../vendor/yiisoft/yii2/base/Application.php:380
1	craft\web\Application::run()
Called from /.../web/index.php:21

Additional info

  • Craft version: Craft Pro 3.0.0-beta.26
  • PHP version: 7.0.23
  • Database driver & version: MySQL 5.7.19-0ubuntu0.16.04.1
  • Plugins & versions:
    Element API | 2.4.2
    Guest Entries | 2.1.0

Thanks!

Greetings
crazyx13th

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions