Im using a the hook
public function processDatamap_afterAllOperations(DataHandler &$pObj)
{
}
I want to read the protected mmHistoryRecords
from the DataHandler
Class.
How can I do this in my class? My class already extends BackendUtility
Im using a the hook
public function processDatamap_afterAllOperations(DataHandler &$pObj)
{
}
I want to read the protected mmHistoryRecords
from the DataHandler
Class.
How can I do this in my class? My class already extends BackendUtility
I don't see another option than using XCLASS for the DataHandler and adding a getter method for this property.
You can't access a protected property from outside the class it's in. That's the whole idea of protected (and private) properties. You'd need a getter method, so you can either request one from the core developers or xclass DataHandler
to add it yourself.
The problem with xclass is that it might not work anymore after an update of TYPO3 if the class you're xclassing is changed, but the chance of that if you're only adding a getter for the protected property you need is pretty small for minor TYPO3 updates.
You can find more on xclass here: https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Xclasses/Index.html
You can use reflection to access protected properties or methods. That saves you from XCLASSing.
You can use it on methods and properties. So in PHP nothing is ever "private"... You need to judge yourself if you should do it, but it's always a possiblity.