TYPO3 Exception 1249479819

Note

Below, the TYPO3 community may have provided additional information or solutions for this exception. However, these may or may not apply to your particular case. If you can provide more information, you should come back here and add your experience and solution steps to this issue once you have resolved it.

General TYPO3 troubleshooting tips can be found in the section "Troubleshooting" of the menu, and live support is available in the TYPO3 Slack channel #typo3-cms. (See How to get your TYPO3 Slack account.)

To add your experience, click "Edit on GitHub" above and follow the "Edit on GitHub" workflow. Also check out our tip on Coding Style and reST.

Persistence

You need to make sure that your object is already persisted before calling Repository->update($o); Add it first with Repository->add($o);

Usage of (new) property mapper / t3extblog

I encountered this exception when trying to install/use t3extblog with TYPO3 6.2.10. Check your code for correct usage of (new) property mapper, this should give you a hint (taken from https://forge.typo3.org/issues/51330):

old property mapper is not supported anymore and removed from the Core after 6.2. Use the new one instead.

For those who do not know how to fix it, I will show how I have fixed it.

Old code:

$persistenceManager =
\\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Extbase_Persistence_Manager');

New code:

$objectManager =
\\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$persistenceManager =
$objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);

Object retrieved by property mapper can't get updated via persistence manager

If you try to ->update() an object which has been retrieved from the property mapper by mapping GET/POST parameters, so if you pass the object as argument of your controller action, this issue may occur.

For me the solution was to re-retrieve the object using the repository and ->findByUid() method and then persist/update the retrieved object. It seems the repository needs to "know" about the object.

function yourAction(\Some\Model $item)
{
    $updateItem = $this->itemRepository->findByUid($item->getUid());
    /**
     *  something with $updateItem ...
     */
    $this->itemRepository->update($updateItem);
}