Git Product home page Git Product logo

fetch's People

Contributors

brandonkelly avatar wesrice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fetch's Issues

Related elements limit is set to 100

I have an interesting issue.

I have a set of about thirty elements and I want to get all of their assets. Each element has 3-5 assets.
This means that over 100 assets will need to be retrieved for my source elements.

However, I'm running into an issue with this code.

$elements = craft()->elements->getCriteria($elementType)
                ->id($targetIds)
                ->indexBy('id')
                ->locale($sourceLocale)
                ->find();

The limit is not set the criteria model, so it inherits Craft's default limit of 100, which is less than the amount needed in my use case.

The simple thing is to add ->limit(null), but I'm not sure what negative effects this could have on usage. I'm thinking that it won't have any effect, since there is no sort of pagination on the related elements. If the performance is slow, then it can be up to the developer to limit the number of source elements.

I don't really think it will be a bad thing to add the null limit, so I'm going to make a pull request to change this. I just wanted to explain it a bit.

Undefined offset (fetch/services/FetchService.php(72))

Hi I was very happy when find out this plug in, and so much want to work. This plug in work great for categories for me, but I have a problem with assets. When I try to get related assets a get this error:
Undefined offset: 427
/craft/plugins/fetch/services/FetchService.php(72)

I use it like this:

{% set boatBoxs = craft.entries.section('boats').find() %}
{% do craft.fetch.assets(boatBoxs, 'boatGallery') %}

But if I limit the array to 7 entries it work perfect:

{% set boatBoxs = craft.entries.section('boats').limit(7).find() %}
{% do craft.fetch.assets(boatBoxs, 'boatGallery') %}

... if i limit it to 8 it broke again

{% set boatBoxs = craft.entries.section('boats').limit(8).find() %}
{% do craft.fetch.assets(boatBoxs, 'boatGallery') %}

Undefined offset: 4107

.. if i make a offset and limit to to 5, works

{% set boatBoxs = craft.entries.section('boats').offset(7).limit(5).find() %}
{% do craft.fetch.assets(boatBoxs, 'boatGallery') %}

.. if i make a offset and limit to to 6, feil

{% set boatBoxs = craft.entries.section('boats').offset(7).limit(5).find() %}
{% do craft.fetch.assets(boatBoxs, 'boatGallery') %}

Undefined offset: 3902

What can be the problem??? And can this be fixed?

Pagination Issues

Hi,

I'm not sure how actively this is being developed but I'm running into issues with paginating the query, adding filtering to the query and the fetch plugin.

My current setup is as follows

{% set params = {
    section : 'restaurants',
    limit: 18,
    search : (searchQuery is defined) ? searchQuery
    }
%}

{% set query = craft.entries(params) %}

{% if relatedTo | length > 1 %}
    {% set query = query.relatedTo(relatedTo) %}
{% endif %}

{% if searchQuery | length %}
    {% set query = query.search(searchQuery) %}
{% endif %}

{% do craft.fetch.assets(query.find(), 'images') %}

and my template code

    {% paginate query as restaurantList %}

    {% for entry in restaurantList %}

    {% set image = entry.fetched('images')[0] %}
    {{image code }}
    {% endfor %}

    {{ pagination nav code }}

    {% endpaginate %}

Main issue I'm getting is

Craft\EntryModel and its behaviors do not have a method or closure named "fetched".

But only on the /page/n pages

Fetch relations from multiple element types

Hi Mike,

Is there any way to do the following:

{% do craft.fetch.categories(upcomingEvents.find(), 'categories') %}
{% do craft.fetch.assets(upcomingEvents.find(), 'images') %}

It seems the fetched method will always get overridden by the last craft.fetch.xx template variable.

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.