I have a form that submits data to my controller. The function createAction() takes care for adding a new record to the database.
I need to get a certain value (specialValue
) from the previous record in the database, which is neither deleted nor hidden. However, with the following, I can only get the uid (not respecting the deleted/hidden state).
public function createAction(Tx_MyExt_Domain_Model_MyObject $myobject) {
$this->myObjectRepository->add($myobject);
$persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
$persistenceManager->persistAll();
$uid = $myobject->getUid();
$previousMyObject = $this->myObjectRepository->findByUid($uid-1);
$myobject->setSpecialValue($previousMyObject->getSpecialValue() +1);
}
Is there something like a findPrevious()
method for my repository, or do I have to create it myself?