I am programming a timemanagement extension in Extbase (TYPO3 8). In my model I have the two properties startdate and enddate. Now the duration should be calculated from these properties and stored in the database. After creating the new property duration with the extension builder, I changed my model like this:
/**
* duration
*
* @var int
*/
protected $duration = 0;
/**
* Returns the duration
*
* @return int $duration
*/
public function getDuration()
{
return $this->duration;
}
/**
* Sets the duration
*
* @return void
*/
public function setDuration($duration)
{
return $this->duration = intval($this->enddate->format('U')) - intval($this->startdate->format('U'));
}
But the calculated time is not inserted into the database.
What am I doing wrong?