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

Also available in: Atom PDF