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

Fixed Twig examples #587

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/5.x/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ We plan to introduce a console command to handle merging similar fields. There i
])
.all() %}

{% for article in article %}
{% for article in articles %}
{% set image = article.featureImage|first %}
{% if image %}
{{ image.getImg() }}
Expand All @@ -256,7 +256,7 @@ We plan to introduce a console command to handle merging similar fields. There i
.section('blog')
.all() %}

{% for article in article %}
{% for article in articles %}
{% set image = article.featureImage.eagerly().one() %}

{# Testing whether there was a result is still a good idea: #}
Expand All @@ -278,7 +278,7 @@ This feature does have _some_ limitations, though. While it will work for all el
])
.all() %}

{% for article in article %}
{% for article in articles %}
{# Lazily-eager-loaded relation: #}
{% set image = article.featureImage.eagerly().one() %}

Expand All @@ -287,7 +287,7 @@ This feature does have _some_ limitations, though. While it will work for all el
{% endif %}

{# Explicitly eager-loaded element: #}
<span>{{ entry.author.fullName }}</span>
<span>{{ article.author.fullName }}</span>
{% endfor %}
```

Expand Down
Loading