Answers.Body: <p>This seems to have fixed the issue.</p>
  
  <pre><code>{% if reldata %}
      {% set tag = craft.tags.title(reldata|join(', ')) %}
      {% set feat = craft.entries.section(data|join(', ')).relatedTo(tag).limit(8).all() %}
  {% else %}
      {% set feat = craft.entries.section(data|join(', ')).limit(8).all() %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-23T03:38:33.513Z
Answers.LastActivityDate: 2018-10-23T03:38:33.513Z
Answers.UserDisplayName: Bowenac
Body: <p>Working on fixing a lot of deprecated code, enviroment is setup as dev so getting a lot of warnings. Some are easily idetified, others are pretty generic and come from core files. Doesn't show where the issue is... So I have been going through each block template removing code till the page loads to narrow it down.</p>
  
  <p>Example Warning:
  strtolower() expects parameter 1 to be string, array given from /vendor/craftcms/cms/src/helpers/Db.php</p>
  
  <pre><code> $firstVal = strtolower(reset($value));
  </code></pre>
  
  <p>I have narrowed an existing issue down to the following code from a block template, however I have tried a few different ways but the page will not load with the following code. Anyone know a way to resolve this, it seems to be an issue with the relatedTo</p>
  
  <p>Source of problem? Setting up section</p>
  
  <pre><code>{% for feed in block.feeds %}
      {% if feed == 'all' %}
          {% set data = ['blog', 'caseStudies', 'dataSheets', 'events', 'news', 'webinars', 'whitePapers', 'artices', 'productDemos'] %}
          {% set break = true %}
      {% else %}
          {% set data = data|merge({ (loop.index0):feed }) %}
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Source of problem? Setting up relatedTo</p>
  
  <pre><code>{% for related in block.relatedTo %}
      {% if related == 'All' %}
          {% set reldata = false %}
          {% set break = true %}
      {% else %}
          {% set reldata = reldata|merge({ (loop.index0):related }) %}
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>Then Setting up the query seems to be an issue with the section(data) but not sure what needs changed as I do not see a clear deprecation warning, or stacktrace</p>
  
  <pre><code>{% if reldata %}
      {% set tag = craft.tags.title(reldata) %}
      {% set feat = craft.entries.section(data).relatedTo(tag).limit(8).all() %}
  {% else %}
      {% set feat = craft.entries.section(data).limit(8).all() %}
  {% endif %}
  </code></pre>
  
Tags: <craft3><sections><relatedto>
Title: Fixing deprecated code, relatedTo issue
ThreadText: # Fixing deprecated code, relatedTo issue
  
  (Asked by: username_0 on 2018-10-22)
  
  Working on fixing a lot of deprecated code, enviroment is setup as dev so getting a lot of warnings. Some are easily idetified, others are pretty generic and come from core files. Doesn't show where the issue is... So I have been going through each block template removing code till the page loads to narrow it down.
  
  Example Warning:
  strtolower() expects parameter 1 to be string, array given from /vendor/craftcms/cms/src/helpers/Db.php
  
  ```
   $firstVal = strtolower(reset($value));
  
  ```
  
  I have narrowed an existing issue down to the following code from a block template, however I have tried a few different ways but the page will not load with the following code. Anyone know a way to resolve this, it seems to be an issue with the relatedTo
  
  Source of problem? Setting up section
  
  ```
  {% for feed in block.feeds %}
      {% if feed == 'all' %}
          {% set data = ['blog', 'caseStudies', 'dataSheets', 'events', 'news', 'webinars', 'whitePapers', 'artices', 'productDemos'] %}
          {% set break = true %}
      {% else %}
          {% set data = data|merge({ (loop.index0):feed }) %}
      {% endif %}
  {% endfor %}
  
  ```
  
  Source of problem? Setting up relatedTo
  
  ```
  {% for related in block.relatedTo %}
      {% if related == 'All' %}
          {% set reldata = false %}
          {% set break = true %}
      {% else %}
          {% set reldata = reldata|merge({ (loop.index0):related }) %}
      {% endif %}
  {% endfor %}
  
  ```
  
  Then Setting up the query seems to be an issue with the section(data) but not sure what needs changed as I do not see a clear deprecation warning, or stacktrace
  
  ```
  {% if reldata %}
      {% set tag = craft.tags.title(reldata) %}
      {% set feat = craft.entries.section(data).relatedTo(tag).limit(8).all() %}
  {% else %}
      {% set feat = craft.entries.section(data).limit(8).all() %}
  {% endif %}
  
  ```
  
  **Tags:** craft3, sections, relatedto
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-10-23. Score: 1
  
  This seems to have fixed the issue.
  
  ```
  {% if reldata %}
      {% set tag = craft.tags.title(reldata|join(', ')) %}
      {% set feat = craft.entries.section(data|join(', ')).relatedTo(tag).limit(8).all() %}
  {% else %}
      {% set feat = craft.entries.section(data|join(', ')).limit(8).all() %}
  {% endif %}
  
  ```
  
  
  ---
  
  