[TYPO3-core] Hard-coded MM table name in CategoryCollection class
François Suter
fsu-lists at cobweb.ch
Mon Nov 4 08:38:31 CET 2013
Hi all,
While working on system categories-related patches (in particular the
content element menu [1]), I wondered about the structure of the
\TYPO3\CMS\Core\Category\Collection\CategoryCollection: the name of the
reference table (in this case "sys_categories") is stored in a static
variable, which is logical since this is defined that way in the parent
class \TYPO3\CMS\Core\Collection\AbstractRecordCollection.
However the MM table ("sys_category_record_mm") is hard-code into the
queries. Should it be a static variable too? Would it actually make any
sense, since someone wanting to retrieve relation from another table may
well need to override \CMS\Core\Category\Collection\CategoryCollection
anyway?
I opened a Forge issue about [2] in which Philipp Gampe said that this
should be discussed here. Hence this post. Philipp meant that this could
be a TCA setting. It actually is since it is the name of the MM table as
defined in the TCA for the categories-relation field, but I don't see
how the \CMS\Core\Category\Collection\CategoryCollection could be aware
of the TCA. If we go that way, then we indeed need to make the MM table
a static (or not) variable, with a getter and a setter, which would be
used from the class calling CategoryCollection (which is where one would
be aware of TCA settings).
What do you think?
Cheers
--
Francois Suter
Work: Cobweb Development Sarl - http://www.cobweb.ch
TYPO3: Help the project! - http://typo3.org/contribute/
Appreciate my work? Support me -
http://www.monpetitcoin.com/en/francois/support-me/
[1] https://review.typo3.org/#/c/23905/
[2] http://forge.typo3.org/issues/53146
More information about the TYPO3-team-core
mailing list