Closed cbleek closed 6 years ago
# bin/console purge expired-jobs --options='{"days":90, "limit":300}'
leads to:
5ae6eddc7bb2b5be4b8b [-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------> ] 77% ETA 00:00:06====================================================================== The application has thrown an exception! ====================================================================== InvalidArgumentException A new document was found through a relationship that was not configured to cascade persist operations: Jobs\Entity\Job@000000000e32422400000000470e927d. Explicitly persist the new document or configure cascading persist operations on the relationship. ---------------------------------------------------------------------- /var/www/YAWIK/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:988 #0 /var/www/YAWIK/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php(846): Doctrine\ODM\MongoDB\UnitOfWork->computeAssociationChanges(Object(Jobs\Entity\JobSnapshot), Array, Object(Jobs\Entity\Job)) #1 /var/www/YAWIK/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php(689): Doctrine\ODM\MongoDB\UnitOfWork->computeOrRecomputeChangeSet(Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata), Object(Jobs\Entity\JobSnapshot)) #2 /var/www/YAWIK/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php(924): Doctrine\ODM\MongoDB\UnitOfWork->computeChangeSet(Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata), Object(Jobs\Entity\JobSnapshot)) #3 /var/www/YAWIK/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php(395): Doctrine\ODM\MongoDB\UnitOfWork->computeChangeSets() #4 /var/www/YAWIK/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php(542): Doctrine\ODM\MongoDB\UnitOfWork->commit(NULL, Array) #5 /var/www/YAWIK/module/Core/src/Core/Repository/RepositoryService.php(86): Doctrine\ODM\MongoDB\DocumentManager->flush() #6 /var/www/YAWIK/module/Core/src/Core/Controller/Plugin/EntityEraser.php(155): Core\Repository\RepositoryService->remove(Object(Jobs\Entity\Job)) #7 /var/www/YAWIK/module/Core/src/Core/Controller/Console/PurgeController.php(122): Core\Controller\Plugin\EntityEraser->erase(Object(Jobs\Entity\Job)) #8 /var/www/YAWIK/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Core\Controller\Console\PurgeController->indexAction() #9 /var/www/YAWIK/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent)) #10 /var/www/YAWIK/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure)) #11 /var/www/YAWIK/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent)) #12 /var/www/YAWIK/vendor/zendframework/zend-mvc-console/src/Controller/AbstractConsoleController.php(56): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response)) #13 /var/www/YAWIK/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Console\Controller\AbstractConsoleController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response)) #14 /var/www/YAWIK/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent)) #15 /var/www/YAWIK/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure)) #16 /var/www/YAWIK/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent)) #17 /var/www/YAWIK/public/index.php(56): Zend\Mvc\Application->run() #18 /var/www/YAWIK/bin/console(2): include('/var/www/YAWIK/...') #19 {main} ======================================================================
Damn, I forgot about the snapshots....
In production environments, it is necessary to delete the config cache files.
# bin/console purge expired-jobs --options='{"days":90, "limit":300}'
leads to: