[TYPO3-mvc] Repository does not save added objects
Patrick Schriner
patrick.schriner at diemedialen.de
Thu Feb 28 16:22:40 CET 2013
If you are not in an extbase action context, you have to call the
persistence managers persistAll() method yourself. Just adding an object
to a repository won't suffice.
Look at:
http://forum.typo3.org/index.php?t=msg&th=193893&goto=672993&#msg_672993
(in german, short version in english; All using < 6.0 non-namespaced
classes):
// get an ObjectManager first
$objectManager =
t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
// get persistence manager
$persistenceManager =
$objectManager->get('Tx_Extbase_Persistence_Manager');
// injection will work now, when we use the object manager and not
makeInstance
$eventRepository =
$objectManager->get('Tx_WrCalendar_Domain_Repository_EventRepository');
...
// or add, doesn't matter
$eventRepository->update($event);
...
// persist!
$persistenceManager->persistAll(); // ...und jetzt ist auch das Feld
On Thu, 28 Feb 2013 15:43:10 +0100, Philipp <philippwrann at gmx.at> wrote:
> I am not coming from a actioncontroller, my base is my TCEmain Hook
>
> I just hate it.
--
Patrick Schriner
More information about the TYPO3-project-typo3v4mvc
mailing list