[TYPO3-core] RFC #16294: Bug: Relations with MM_opposite_field don't update the relation count of opposite field
Steffen Gebert
steffen at steffen-gebert.de
Sun Dec 12 12:43:53 CET 2010
Hi Kevin,
> i added the inval() function to the values.
I have some trouble while testing. I used EXT:contagged field "See also".
What I later recognized is that this field doesn't have a foreign_field
set, but has the following TCA config:
> 'related' => Array (
> 'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.related',
> 'config' => Array (
> 'type' => 'group',
> 'internal_type' => 'db',
> 'allowed' => '*',
> 'MM' => 'tx_contagged_related_mm',
> 'size' => 3,
This line, which you added, is always executed (but often accesses the
non-existant key $foreign_field (not only for contagged)
> $this->foreignField·=·$conf['foreign_field'];
Could this be wrapped into a if-clause, like it's done with e.g.
$MMtable below?
However, more problematic is the following code:
> if ($this->MM_is_foreign) {
> ...
> } else {
> // update the value for this table
> $GLOBALS['TYPO3_DB']->exec_UPDATEquery($tablename, $whereClause, array($this->foreignField => $count));
> }
The UPDATEquery fails, because $this->foreignField is NULL. So we would
at least need a elseif(!isnull()) check, instead of just always
executing it.
Could you please have a look again, how to prevent this side-effects for
fields without foreignField and try to encapsulate it a bit?
Can you give some examples (extensions), how you tested it, to easily
reproduce the case, where the changed code works.
Thanks for your update!
Kind regards
Steffen
--
Steffen Gebert
TYPO3 Core Team Member
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/
More information about the TYPO3-team-core
mailing list