[TYPO3-mvc] Question concerning persistAll
Henjo Hoeksma
me at henjohoeksma.nl
Fri Apr 13 17:08:53 CEST 2012
Hi Lorenz,
did you instantiated the PersistenceManager ?
$persistenceManager =
$this->objectManager->get('Tx_Extbase_Persistence_Manager');
$persistenceManager->persistAll();
Kind regards,
Henjo
Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.
On Fri, Apr 13, 2012 at 11:54, Lorenz Ulrich <lorenz-typo3 at visol.ch> wrote:
> Hi there
>
> To hack around my ObjectStorage sorting problem, I want to manually
> manipulate the database after persisting changes.
>
> So I create a new group of works:
>
> $groupOfWorks = $this->objectManager->create('**Tx_Artbase_Domain_Model_**
> GroupOfWorks');
> $groupOfWorks->setTitle($**groupTitle);
>
>
> I add the group of works to the exhibition:
>
> $this->exhibitionRepository->**findOneByUid($exhibitionUid);
> $exhibition->addGroupOfWorks($**groupOfWorks);
>
>
> And call persistAll():
>
> $this->persistenceManager->**persistAll();
>
>
> After that I want to manipulate the mm table an store the sorting:
>
> Tx_Artbase_Utility_**ObjectStorageSorting::**setSorting($exhibition->**getUid(),
> $groupOfWorks->getUid(), 999999, 'tx_artbase_exhibition_**
> groupofworks_mm');
>
>
> I always thought that calling persistAll would persist all objects and
> therefore also save all changes to the database. But it seems that this is
> not the case. The MySQL log shows the following entries:
>
> UPDATE tx_artbase_exhibition_**groupofworks_mm SET
> sorting_foreign='999999' WHERE uid_local = 9 AND uid_foreign = 34
>
> DELETE FROM tx_artbase_exhibition_**groupofworks_mm WHERE uid_local='9'
>
> INSERT INTO tx_artbase_exhibition_**groupofworks_mm (uid_local,
> uid_foreign, sorting) VALUES ('9', '13', '1')
> INSERT INTO tx_artbase_exhibition_**groupofworks_mm (uid_local,
> uid_foreign, sorting) VALUES ('9', '20', '2')
> INSERT INTO tx_artbase_exhibition_**groupofworks_mm (uid_local,
> uid_foreign, sorting) VALUES ('9', '24', '3')
>
> So obviously the DB changes are not made when I call persistAll() but
> later (and my manual change is overwritten).
>
> Can someone confirm that this is the case? Is there any way around it?
>
> Thanks and best regards,
>
> Lorenz
> ______________________________**_________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>
More information about the TYPO3-project-typo3v4mvc
mailing list