[TYPO3-mvc] Relation-Field of existing objects not updated
Joerg Schoppet
joerg at schoppet.de
Fri Oct 9 02:22:25 CEST 2009
Hi,
I have the following object-"structure".
Invoice
- number
- manuals
- imports
Manual
- name
- price
- invoice
Import
- name
- price
- importedFrom
- invoice
Positions (manual and import) can be created without an invoice. Problem
is, that when I create a new invoice and assign e.g. three Imports, then
the field "imports" is correctly updated with "3", but the "invoice"
fields of the Imports are not updated.
Here is the code of the action:
$invoice =
t3lib_div::makeInstance('Tx_JrCustomer_Domain_Model_Invoice');
$invoiceNumber = $this->calculateNumber(
(int)date('j'),
(int)date('n'),
(int)date('Y')
);
$invoice->setNumber($invoiceNumber);
if (isset($manuals)) {
foreach ($manuals as $manualUid) {
$manual =
$this->manualRepository->findOneByUid($manualUid);
$invoice->addManual($manual);
}
}
if (isset($imports)) {
foreach ($imports as $importUid) {
$import =
$this->importRepository->findOneByUid($importUid);
$invoice->addImport($import);
}
}
Have I missed something?
Joerg
More information about the TYPO3-project-typo3v4mvc
mailing list