[TYPO3-mvc] getting the arguments of the form?

Bastian Waidelich bastian at typo3.org
Mon Feb 20 15:51:58 CET 2012

Stig Nørgaard Færch wrote:


> Then I found I could get the original value with _getCleanProperty():
> if($person->_getCleanProperty('streetName') != $person->getStreetName()) {
> // The value has changed
> }
> Is this the way?

Not quiet. The leading underscore should emphasize that this method is 
not part of the Public API [1] (it only needs to be public because it is 
called by the framework).
So while this might work for you it is not assured that this behavior 
stays the same in upcoming versions of Extbase.

Interesting to know is that the setter of a property is only called when 
the respective property was changed, the unchanged properties are 
initialized with some magic.
You could make use of that by adding some getter that returns all 
changed fields:

protected $modifiedProperties = array();

public function setStreetName($streetName) {
	$this->modifiedProperties['streetName'] = $streetName;
	$this->streetName = $streetName;

public function getModifiedProperties() {
	return $this->modifiedProperties;

While this seems cleaner code-wise, it's still a bit tedious and 
error-prone (you have to remember to add the line for every new property).
Out of curiosity: Why do you need to compare the fields?


[1] http://forge.typo3.org/projects/typo3v4-mvc/wiki/Public_API

More information about the TYPO3-project-typo3v4mvc mailing list