Actions
Bug #87651
closedLazy loading (sometimes) not working in Fluid (only n:1 relations)
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;
}
}
Actions