Giter Club home page Giter Club logo

craft-eagerbeaver's People

Contributors

khalwat avatar scandella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

craft-eagerbeaver's Issues

Typings issue when using the `children` of the entry to eager load

Describe the bug

I'm currently updating one of our largest projects to C4 and we're using eager beaver on that one. seems like I'm having issues when using entry.children()

To reproduce

{%- set modules = entry.children() -%}

{%- do craft.eagerBeaver.eagerLoadElements(modules, [
        'contentBuilder'
    ])
-%}

This results in this error:

nystudio107\eagerbeaver\variables\EagerBeaverVariable::eagerLoadElements(): Argument #1 ($elements) must be of type craft\base\ElementInterface|array, craft\elements\db\EntryQuery given, called in /var/www/project/cms/vendor/twig/twig/src/Extension/CoreExtension.php on line 1607

I also eager load the entry.children bit as shown here:

{%- do craft.eagerBeaver.eagerLoadElements(entry, [
        'children',
    ])
-%}

{%- set modules = entry.children() -%}

{%- do craft.eagerBeaver.eagerLoadElements(modules, [
        'contentBuilder'
    ])
-%}

This results in this error:

nystudio107\eagerbeaver\variables\EagerBeaverVariable::eagerLoadElements(): Argument #1 ($elements) must be of type craft\base\ElementInterface|array, Illuminate\Support\Collection given, called in /var/www/project/cms/vendor/twig/twig/src/Extension/CoreExtension.php on line 1607

Versions

  • Plugin version: 4.0.1
  • Craft version: Craft Pro 4.2.1.1

Image transforms

Can this also be used for eager loading image transformations? If you eager load assets and loop over them, you'd still get a N+1 problem if each image has an image transformation applied.

The 'withTransforms' option below fixes this, but haven't figured out yet how to utilize that with eagerbeaver or the native Craft eagerLoadElements method.

{% set image = entry.imageField
    .withTransforms([
        'transformation'
    ])
    .one()
%}

Not works with Super Table

I see that Super table supports Eager loading and it works well with native craft queries but when I try to do eager loading with this plugin, it simply not works.

Is there any way I can use this plugin for eager loading Super table elements?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.