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

Server error with Neo plugin #28

Open
ugrupp opened this issue Aug 2, 2021 · 5 comments
Open

Server error with Neo plugin #28

ugrupp opened this issue Aug 2, 2021 · 5 comments
Assignees

Comments

@ugrupp
Copy link

ugrupp commented Aug 2, 2021

On listing the assets in the media library, I'm getting a server error notification. In the console it says:

error: "An exception has been thrown during the rendering of a template (\"Getting unknown property: benf\\neo\\Field::contentTable\")."
exception: "Twig\\Error\\RuntimeError"
file: "/app/vendor/craftcms/cms/src/templates/_elements/tableview/elements.html"
line: 27

for the request /index.php?p=admin/actions/element-indexes/get-elements&v=1627900326070

So I assume this plugin currently doesn't work with assets linked inside Neo fields?

I'm using
Craft Pro 3.6.17
Neo 2.10.6

@roelvanhintum
Copy link
Member

Hi @ugrupp, thanks for posting the issue. I'm not sure how Neo would influence the usage field in the overview. The only thing that is checked for the usage is the asset's id against the relations table. Are you getting the same error with the Asset Usage plugin disabled, or the usage fields turned off in the overview?

Can you provide some more context, like a stacktrace?

@ugrupp
Copy link
Author

ugrupp commented Aug 2, 2021

The error only happens when the usage options is turned on in the assets overview. I'll post the full error response below.

{
  "error": "An exception has been thrown during the rendering of a template (\"Getting unknown property: benf\\neo\\Field::contentTable\").",
  "exception": "Twig\\Error\\RuntimeError",
  "file": "/app/vendor/craftcms/cms/src/templates/_elements/tableview/elements.html",
  "line": 27,
  "trace": [
    {
      "file": "/app/vendor/twig/twig/src/Template.php",
      "line": 378,
      "function": "displayWithErrorHandling",
      "class": "Twig\\Template",
      "type": "->"
    },
    {
      "file": "/app/storage/runtime/compiled_templates/20/20b2b56fb270762289f951fac069adfa16fdf5eff0f2a38b71b02c2a4033234f.php",
      "line": 102,
      "function": "display",
      "class": "Twig\\Template",
      "type": "->"
    },
    {
      "file": "/app/vendor/twig/twig/src/Template.php",
      "line": 405,
      "function": "doDisplay",
      "class": "__TwigTemplate_6d4eca6c886ed43335d2b9847bd978902cf44280c70094c44b624ca5efd1c05e",
      "type": "->"
    },
    {
      "file": "/app/vendor/twig/twig/src/Template.php",
      "line": 378,
      "function": "displayWithErrorHandling",
      "class": "Twig\\Template",
      "type": "->"
    },
    {
      "file": "/app/vendor/twig/twig/src/Template.php",
      "line": 390,
      "function": "display",
      "class": "Twig\\Template",
      "type": "->"
    },
    {
      "file": "/app/vendor/twig/twig/src/TemplateWrapper.php",
      "line": 45,
      "function": "render",
      "class": "Twig\\Template",
      "type": "->"
    },
    {
      "file": "/app/vendor/twig/twig/src/Environment.php",
      "line": 318,
      "function": "render",
      "class": "Twig\\TemplateWrapper",
      "type": "->"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/web/View.php",
      "line": 389,
      "function": "render",
      "class": "Twig\\Environment",
      "type": "->"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/base/Element.php",
      "line": 741,
      "function": "renderTemplate",
      "class": "craft\\web\\View",
      "type": "->"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/controllers/ElementIndexesController.php",
      "line": 526,
      "function": "indexHtml",
      "class": "craft\\base\\Element",
      "type": "::"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/controllers/ElementIndexesController.php",
      "line": 135,
      "function": "elementResponseData",
      "class": "craft\\controllers\\ElementIndexesController",
      "type": "->"
    },
    {
      "function": "actionGetElements",
      "class": "craft\\controllers\\ElementIndexesController",
      "type": "->"
    },
    {
      "file": "/app/vendor/yiisoft/yii2/base/InlineAction.php",
      "line": 57,
      "function": "call_user_func_array"
    },
    {
      "file": "/app/vendor/yiisoft/yii2/base/Controller.php",
      "line": 181,
      "function": "runWithParams",
      "class": "yii\\base\\InlineAction",
      "type": "->"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/web/Controller.php",
      "line": 190,
      "function": "runAction",
      "class": "yii\\base\\Controller",
      "type": "->"
    },
    {
      "file": "/app/vendor/yiisoft/yii2/base/Module.php",
      "line": 534,
      "function": "runAction",
      "class": "craft\\web\\Controller",
      "type": "->"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/web/Application.php",
      "line": 278,
      "function": "runAction",
      "class": "yii\\base\\Module",
      "type": "->"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/web/Application.php",
      "line": 581,
      "function": "runAction",
      "class": "craft\\web\\Application",
      "type": "->"
    },
    {
      "file": "/app/vendor/craftcms/cms/src/web/Application.php",
      "line": 257,
      "function": "_processActionRequest",
      "class": "craft\\web\\Application",
      "type": "->"
    },
    {
      "file": "/app/vendor/yiisoft/yii2/base/Application.php",
      "line": 392,
      "function": "handleRequest",
      "class": "craft\\web\\Application",
      "type": "->"
    },
    {
      "file": "/app/web/index.php",
      "line": 26,
      "function": "run",
      "class": "yii\\base\\Application",
      "type": "->"
    }
  ]
}

@ugrupp
Copy link
Author

ugrupp commented Aug 2, 2021

I just noticed this only happens for the "current usage" table option.

@ugrupp
Copy link
Author

ugrupp commented Aug 2, 2021

Found a better stacktrace:

2021-08-02 14:00:55 [-][1][1f0a08095caf8fdec7cb9808f88c1031][error][Twig\Error\RuntimeError] yii\base\UnknownPropertyException: Getting unknown property: benf\neo\Field::contentTable in /app/vendor/yiisoft/yii2/base/Component.php:155
Stack trace:
#0 /app/vendor/craftcms/cms/src/elements/db/MatrixBlockQuery.php(469): yii\base\Component->__get('contentTable')
#1 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1382): craft\elements\db\MatrixBlockQuery->beforePrepare()
#2 /app/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder))
#3 /app/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\MatrixBlockQuery))
#4 /app/vendor/yiisoft/yii2/db/Query.php(287): yii\db\Query->createCommand(Object(craft\db\Connection))
#5 /app/vendor/craftcms/cms/src/db/Query.php(168): yii\db\Query->one(NULL)
#6 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1562): craft\db\Query->one(NULL)
#7 /app/vendor/craftcms/cms/src/services/Elements.php(536): craft\elements\db\ElementQuery->one()
#8 /app/vendor/craftcms/cms/src/services/Elements.php(458): craft\services\Elements->_elementById('id', 17, 'craft\\elements\\...', NULL, Array)
#9 /app/vendor/born05/craft-assetusage/src/services/Asset.php(48): craft\services\Elements->getElementById(17)
#10 /app/vendor/born05/craft-assetusage/src/Plugin.php(75): born05\assetusage\services\Asset->getCurrentUsage(Object(craft\elements\Asset))
#11 [internal function]: born05\assetusage\Plugin->born05\assetusage\{closure}(Object(craft\events\SetElementTableAttributeHtmlEvent))
#12 /app/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\events\SetElementTableAttributeHtmlEvent))
#13 /app/vendor/yiisoft/yii2/base/Component.php(637): yii\base\Event::trigger('craft\\elements\\...', 'setTableAttribu...', Object(craft\events\SetElementTableAttributeHtmlEvent))
#14 /app/vendor/craftcms/cms/src/base/Element.php(3125): yii\base\Component->trigger('setTableAttribu...', Object(craft\events\SetElementTableAttributeHtmlEvent))
#15 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1511): craft\base\Element->getTableAttributeHtml('currentUsage')
#16 /app/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\elements\Asset), 'getTableAttribu...', Array, 'method', false, false)
...

@codename-niels codename-niels self-assigned this Jun 20, 2023
@codename-niels
Copy link
Contributor

This should be fixed in 3.2.0. Can you let us know?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants