Bug #87651
closedLazy loading (sometimes) not working in Fluid (only n:1 relations)
0%
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;
}
}
Updated by Markus Opahle over 5 years ago
Looks like \TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider cannot handle the magic methods from LazyLoadingProxy
Updated by Claus Due over 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.
Updated by Steffen Müller over 5 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
Updated by Till Wimmer about 5 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.
Updated by Steffen Müller about 5 years ago
current TYPO3/Fluid release 2.6.4 fixes the issue,
composer installations should receive the fix
Updated by Till Wimmer about 5 years ago
Thanks for the info. And when do non-composer installations receive the fix?
Updated by Chris no-lastname-given about 5 years ago
I can confirm this issue with TYPO3 9.5.10 (non-composer installation).
Updated by Chris no-lastname-given almost 5 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...
Updated by Felix Holler almost 5 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
Updated by Chris no-lastname-given almost 5 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.
Updated by Chris no-lastname-given almost 5 years ago
- Related to Bug #90215: Getters of class LazyLoadingProxy can't be called by Fluid added
Updated by Stephan Großberndt about 4 years ago
- Related to Bug #87899: Magic getters stop to be evaluated in Fluid starting from TYPO3 9 added
Updated by Tizian Schmidlin about 4 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