Project

General

Profile

Actions

Bug #87651

closed

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

Added by Jan Kornblum about 5 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2019-02-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I've got several domain objects which contain serveral n:1 relations (1:n relations, too, but these work as expected). Accessing the related objects in fluid inside a <f:for> sometimes returns nothing for some relations. Accessing the same relation from a single object instead, retrives the relation

All relations are setup exactly up equal (in model, tca, ext_tables.sql). Example:

<f:for each="{customers}" as="customer">
   {customer.category.title} // works
   {customer.status.title} // doesn't work (but <f:debug>{customer.status}</f:debug> works)
<f:for>

<f:for each="{contacts}" as="contact">
   {contact.category.title} // works
   {contact.position.title} // doesn't work (but <f:debug>{contact.position}</f:debug> works)
<f:for>

As i said, all relations are defined exactly the same way! I don't make use of any '_loadRealInstance()' in my models - should this be neccessary? Example part of a model:


class Customer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{

    /**
     * Category
     *
     * @var \Vendor\Ext\Domain\Model\CustomerCategory
     * @lazy
     */
    protected $category = null;

    /**
     * Returns the category
     *
     * @return \Vendor\Ext\Domain\Model\CustomerCategory $category
     */
    public function getCategory()
    {
        return $this->category;
    }

    /**
     * Sets the category
     *
     * @param \Vendor\Ext\Domain\Model\CustomerCategory $category
     * @return void
     */
    public function setCategory(\Vendor\Ext\Domain\Model\CustomerCategory $category = NULL)
    {
        $this->category = $category;
    }

}


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Bug #90215: Getters of class LazyLoadingProxy can't be called by FluidAccepted2020-01-27

Actions
Related to TYPO3 Core - Bug #87899: Magic getters stop to be evaluated in Fluid starting from TYPO3 9Closed2019-03-13

Actions
Actions #1

Updated by Markus Opahle about 5 years ago

Looks like \TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider cannot handle the magic methods from LazyLoadingProxy

Actions #2

Updated by Claus Due about 5 years ago

  • Status changed from New to Resolved

See https://github.com/TYPO3/Fluid/pull/438 which solves this. Will be in the next release of Fluid.

Closing the issue since the problem is not in TYPO3 CMS.

Actions #3

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions #4

Updated by Steffen Müller over 4 years ago

This fix in not applied in TYPO3 9.5.8, currently only in TYPO3/Fluid master.
AFAIK it would require
- [ ] backporting the patch to 2.6 branch,
- [ ] releasing TYPO3/Fluid 2.6.2
- [ ] releasing new version of typo3-cms/fluid

Actions #5

Updated by Till Wimmer over 4 years ago

It's not solved in 9.5.9 either.

Will this be fixed? It makes our extensions partly unusable, or we have to remove lazy loading.

I also get problems when passing certain properties with lazy loading to repositorie's find methods.

E.g.

myRepositpory->findByMessungAndJahr($status->getMessung(), $status->getJahr());

throws
Argument 2 passed to ... mmust be an instance of ...\Jahr instance of TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy given

Both Messung and Jahr are lazy properties, but strangely there is only an issue with Jahr.

Before migrating to 9.x we did not have these issues.

Actions #6

Updated by Steffen Müller over 4 years ago

current TYPO3/Fluid release 2.6.4 fixes the issue,
composer installations should receive the fix

Actions #7

Updated by Till Wimmer over 4 years ago

Thanks for the info. And when do non-composer installations receive the fix?

Actions #8

Updated by Chris no-lastname-given over 4 years ago

I can confirm this issue with TYPO3 9.5.10 (non-composer installation).

Actions #9

Updated by Chris no-lastname-given over 4 years ago

Chris no-lastname-given wrote:

I can confirm this issue with TYPO3 9.5.10 (non-composer installation).

I have to correct myself:
With TYPO3 9.5.10 it is working for me, but not with 9.5.11 (non-composer installation). Interesting...

Actions #10

Updated by Felix Holler over 4 years ago

Chris no-lastname-given wrote:

Chris no-lastname-given wrote:

I can confirm this issue with TYPO3 9.5.10 (non-composer installation).

I have to correct myself:
With TYPO3 9.5.10 it is working for me, but not with 9.5.11 (non-composer installation). Interesting...

Can also confirm. in 9.5.11 non comoser installation the problem is not fixed but in 9.5.10

Actions #11

Updated by Chris no-lastname-given about 4 years ago

Problem still extists with TYPO3 9.5.13 in non composer installation. I have opened a new issue (#90215), which points to this one.

Actions #12

Updated by Chris no-lastname-given about 4 years ago

  • Related to Bug #90215: Getters of class LazyLoadingProxy can't be called by Fluid added
Actions #13

Updated by Stephan Großberndt over 3 years ago

  • Related to Bug #87899: Magic getters stop to be evaluated in Fluid starting from TYPO3 9 added
Actions #14

Updated by Tizian Schmidlin over 3 years ago

I can confirm this issue also exists in 9.5.22, should I require fluid in a higher version and try to bypass TYPO3's requirements?
EDIT: it was a misconfiguration and an erroneous content that led to the "bad" behaviour, could not reproduce in TYPO3 9.5.22

Actions

Also available in: Atom PDF