<p>Solution is simple, the field type is a select so I need to change </p>

<p><code>entry.feedLimit</code></p>

<p>to</p>

<p><code>entry.feedLimit.value</code></p>

<p>And then it works</p>

CC BY-SA 4.0
2018-12-16T01:14:25.067Z
2018-12-16T01:14:25.067Z
CreateSean
<p>I'm processing some feeds using <code>craft.app.feeds.getFeedItems()</code> and it works if I pass the limit as a hard coded number like this:</p>

<pre><code>{% set items = craft.app.feeds.getFeedItems(entry.rssURL, '5') %}
&lt;ul&gt;
    {% for item in items %}
      &lt;li&gt;&lt;a href="{{ item.permalink }}"&gt;{{ item.title }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %} 
&lt;/ul&gt;
</code></pre>

<p>However if I change <code>'5'</code> to a field handle I get errors. where <code>entry.feedLimit</code> is a number such as 3 or 5</p>

<pre><code>{% set items = craft.app.feeds.getFeedItems(entry.rssURL, entry.feedLimit) %}
&lt;ul&gt;
    {% for item in items %}
      &lt;li&gt;&lt;a href="{{ item.permalink }}"&gt;{{ item.title }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %} 
&lt;/ul&gt;
</code></pre>

<p>The errors I get is:</p>

<blockquote>
  <p>TypeError Argument 2 passed to craft\feeds\Feeds::getFeedItems() must
  be of the type integer or null, object given, called in
  /path/to/vendor/twig/twig/lib/Twig/Extension/Core.php
  on line 1619</p>
</blockquote>

<p>This code was previously working on Craft 2, but after the update it is now broken. I've temporarily hard coded the limit in, but that's not ideal.</p>

CC BY-SA 4.0
2018-12-16T01:04:26.933Z
What type of field is `feedLimit`?
Brad Bell
CC BY-SA 4.0
2018-12-16T01:13:42.200Z
it's a select and I solved it by changing code to entry.feedLimit.value
CreateSean
<templating><craft3><error><feed>
Erros when using Entry Variable in craft.app.feeds.getFeedItems
# Erros when using Entry Variable in craft.app.feeds.getFeedItems

(Asked by: username_0 on 2018-12-16)

I'm processing some feeds using craft.app.feeds.getFeedItems() and it works if I pass the limit as a hard coded number like this:
{% set items = craft.app.feeds.getFeedItems(entry.rssURL, '5') %}

    {% for item in items %}
      {{ item.title }}
    {% endfor %} 


However if I change '5' to a field handle I get errors. where entry.feedLimit is a number such as 3 or 5
{% set items = craft.app.feeds.getFeedItems(entry.rssURL, entry.feedLimit) %}

    {% for item in items %}
      {{ item.title }}
    {% endfor %} 


The errors I get is:

TypeError Argument 2 passed to craft\feeds\Feeds::getFeedItems() must
  be of the type integer or null, object given, called in
  /path/to/vendor/twig/twig/lib/Twig/Extension/Core.php
  on line 1619

This code was previously working on Craft 2, but after the update it is now broken. I've temporarily hard coded the limit in, but that's not ideal.

**Tags:** templating, craft3, error, feed

> **Comments:**
> **username_1**: What type of field is `feedLimit`?  
> **username_0**: it's a select and I solved it by changing code to entry.feedLimit.value  

---

## 1 answers

### Answer by username_0 on 2018-12-16. Score: 1

Solution is simple, the field type is a select so I need to change

`entry.feedLimit`

to

`entry.feedLimit.value`

And then it works


---

