Bug #90215

Lazy loading (sometimes) not working in Fluid (only n:1 relations)

Added by Chris no-lastname-given 29 days ago. Updated 7 days ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2020-01-27
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I would like to point to an closed issue with the same headline, since the problem still exists: Bug #87651.

In TYPO3 version 9.5.13 (non composer installation), the n:1 relation can't be resolved in fluid templates.


Related issues

Related to TYPO3 Core - Bug #87651: Lazy loading (sometimes) not working in Fluid (only n:1 relations) Closed 2019-02-05

History

#1 Updated by Chris no-lastname-given 29 days ago

  • Related to Bug #87651: Lazy loading (sometimes) not working in Fluid (only n:1 relations) added

#2 Updated by Wolfgang Klinger 26 days ago

  • Priority changed from Should have to Must have

I can confirm this in composer mode too … 9.5.13, typo3fluid/fluid 2.6.8

If I use a view helper like

                                    <f:groupedFor groupBy="department" groupKey="department" each="{person.roles}" as="relations">
                                        <f:for each="{relations -> v:iterator.sort(sortBy: 'role.priority', order: 'DESC')}" as="relation">
                                            {relation.role.name}, {relation.department.name}<br>
                                        </f:for>
                                    </f:groupedFor>

{relation.role.name} is output (loaded because of the v:iterator.sort view helper), but {relation.department.name} is not

#3 Updated by Guillaume Germain 8 days ago

I also see the problem with TYPO3 9.5.13 and typo3fluid/fluid 2.6.9 in Composer mode.

This bug has an impact on performances.

#4 Updated by Alexander Vogt 8 days ago

We have the same issue (9.5.13, composer mode). Currently we are using a viewhelper as workaround. For example:

<site:lazyLoad model="{relation.department}" />
...
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
  if($arguments['model'] instanceof LazyLoadingProxy)
  {
    $arguments['model']->_loadRealInstance();
  }
}
...

#5 Updated by Johannes Rebhan 7 days ago

We have the same problem. A silly workaround seems to be

<f:if condition="{element.lazy} == null">
... do something with {element.lazy.something}
</f:if>

This seems to trigger the Proxy and initialize the subobject.

Also available in: Atom PDF