Commit 06e9eb79 authored by Stefan Neufeind's avatar Stefan Neufeind Committed by Alexander Schnitzler
Browse files

[FEATURE] Add method LazyLoadingProxy::getUid()

Adding method getUid() to the LazyLoadingProxy class allows for
fetching the uid of proxied objects without fetching the whole
object data from the database first.

This can be used for quick and easy comparisons of objects while
keeping the proxy intact.

Resolves: #86967
Releases: master
Change-Id: Ia78590d84b12c0bf6c8fff63ac7164c26f859ae4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/58925

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Tested-by: default avatarAlexander Schnitzler <review.typo3.org@alexanderschnitzler.de>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: default avatarAlexander Schnitzler <review.typo3.org@alexanderschnitzler.de>
parent 3b4468fa
.. include:: ../../Includes.txt
===========================================================================================
Feature: #86967 - Allow fetching uid of a LazyLoadingProxy without loading the object first
===========================================================================================
See :issue:`86967`
Description
===========
A method :php:`getUid()` has been added to class :php:`\TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy` which
allows for fetching the uid of the proxied object without fetching the object data itself from the database.
Impact
======
The method :php:`getUid()` can be used to fetch the uid of objects for a quick comparison with other objects of the same
type which increases the performance of such comparisons a lot.
.. index:: PHP-API, ext:extbase
......@@ -123,6 +123,14 @@ class LazyLoadingProxy implements \Iterator, LoadingStrategyInterface
return $type . ':' . $this->fieldValue;
}
/**
* @return int
*/
public function getUid(): int
{
return (int)$this->fieldValue;
}
/**
* Magic method call implementation.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment